創(chuàng)建支持typescript的react項(xiàng)目:react-script-ts 支持create-react-app v2新特性,如css module等

最近, create-react-app 發(fā)布了2.0 版本,支持了很多新特性,如Babel 7, Sass, and More...
更新詳情 Create React App 2.0: Babel 7, Sass, and More

最近希望使用在項(xiàng)目中使用typescript和css module。一般來說,

create-react-app my-app --scripts-version=react-scripts-ts

是可以創(chuàng)建使用typescript的react項(xiàng)目的,但是由于最近剛發(fā)布create-react-app 2.0版本,這些新特性react-scripts-ts在正式版中還沒有支持,所以使用這種方式后并不會(huì)支持css module等新特性。

逛了create-react-app 的issues, react-scripts-ts的官方github, stackoverflow后終于發(fā)現(xiàn)了蛛絲馬跡:

Does react-script-ts support create-react-app and CSS/SCSS Modules?

https://github.com/wmonk/create-react-app-typescript/pull/409

作者已經(jīng)在create-react-app提了pr,同時(shí),如果想在項(xiàng)目中體驗(yàn),可以

create-react-app test --scripts-version=react-scripts-ts@4.0.8

注意react-scripts-ts 4.0.8不是穩(wěn)定正式版。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容