You*_*mar 2 javascript css webpack stylelint next.js
我想将Stylelint添加到我的 Next.js 应用程序中。我问是否可以编辑next.config.js以添加stylelint-webpack-plugin,因此我在编译期间收到样式错误。
// next.config.js
module.exports = {
reactStrictMode: true,
};
Run Code Online (Sandbox Code Playgroud)
npm i stylelint stylelint-webpack-plugin --save-dev
Run Code Online (Sandbox Code Playgroud)
.stylelintignore文件并在其中添加:node_modules
Run Code Online (Sandbox Code Playgroud)
next.config.js文件:npm i stylelint stylelint-webpack-plugin --save-dev
Run Code Online (Sandbox Code Playgroud)
npm i stylelint-config-standard --save-dev
Run Code Online (Sandbox Code Playgroud)
.stylelintrc在根文件夹中创建一个文件并将其粘贴到其中:node_modules
Run Code Online (Sandbox Code Playgroud)
npm i sass stylelint-config-standard-scss --save-dev
Run Code Online (Sandbox Code Playgroud)
.stylelintrc在根文件夹中创建一个文件并将其粘贴到其中:const StylelintPlugin = require("stylelint-webpack-plugin"); // line to add
module.exports = {
reactStrictMode: true,
// lines to add
webpack: (config, options) => {
config.plugins.push(new StylelintPlugin());
return config;
},
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4526 次 |
| 最近记录: |