最近, 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)定正式版。