We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack.config.js处的css-loader配置更改为
{ test: /\.(css)$/, use: ["style-loader", { loader: 'css-loader', options: { modules: true, } }], }
src根目录下(注意不是examples的src根目录)新增global.d.ts文件,内容如下,这样tsx引入就不会报错了
declare module '*.css'
src/index.tsx中css引入方式更改为
import styles from './styles.css';
这个时候输出styles就会正确编译为module了 由于更改了css的使用方式,tsx中使用了className的地方需要做调整
// 大概65行处: current.className = current.className + ` ${styles['suspend-button-ts-animate']}`; // 大概186行处: className={`${styles['suspend-button-ts']}`} // 大概171行处 current.className = current.className + ` ${styles['suspend-button-ts-animate']}`;
脚手架可以使用vite、create-react-app
The text was updated successfully, but these errors were encountered:
No branches or pull requests
webpack.config.js处的css-loader配置更改为
src根目录下(注意不是examples的src根目录)新增global.d.ts文件,内容如下,这样tsx引入就不会报错了
src/index.tsx中css引入方式更改为
这个时候输出styles就会正确编译为module了
![image](https://user-images.githubusercontent.com/22978619/160898234-68d2752f-6e04-4416-a713-7f1e0275d552.png)
由于更改了css的使用方式,tsx中使用了className的地方需要做调整
脚手架可以使用vite、create-react-app
The text was updated successfully, but these errors were encountered: