簡體   English   中英

使用typescript將sass加載到create-react-app中

[英]loading sass in a create-react-app with typescript

我最近將create-react-app遷移到打字稿。 遷移后,.tsx組件中的scss文件將被忽略。 我正在這樣導入文件:

import './styles/scss/style.scss';

這在js中工作正常。 我已經安裝了node-sass,甚至嘗試安裝@ types / node-sass。 我想這樣做而不彈出。 將不勝感激。

根據此文檔https://facebook.github.io/create-react-app/docs/adding-a-sass-stylesheet#docsNav

如果您使用react-scripts@2.0.0或更高版本

npm install node-sass

重新啟動並享受。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM