use*_*739 5 javascript sass webpack next.js
如何迁移和更改next.config.js
文件以@zeit/next-sass
使用 Next.js 对 Sass 的内置支持?
https://www.npmjs.com/package/@zeit/next-sass
const withSass = require('@zeit/next-sass')
const withCSS = require("@zeit/next-css");
module.exports = withCSS(withSass({
webpack(config, options) {
config.module.rules.push({
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
use: {
loader: 'url-loader',
options: {
limit: 100000
}
}
});
return config;
}
}));
Run Code Online (Sandbox Code Playgroud)
Next.js 内置 Sass 支持需要您sass
作为依赖项安装。
$ npm install sass
Run Code Online (Sandbox Code Playgroud)
然后,您可以简单地从配置中删除插件@zeit/next-sass
。@zeit/next-css
$ npm install sass
Run Code Online (Sandbox Code Playgroud)
有关更多详细信息,请查看官方 Sass 支持文档。
归档时间: |
|
查看次数: |
5682 次 |
最近记录: |