其实这个我是按照配置scss的方式搞的,没有想到竟然成功了。
创建完项目后,要执行npm eject 也就是打开全部配置项。
安装依赖:yarn stylus stylus-loader
找到config里面的两个配置文档。
配置的内容都是一样的。
关于stylus不多解释,网上太多了。文档后缀是 【 .styl 】
{
loader: require.resolve('file-loader'),
// Exclude `js` files to keep "css" loader working as it injects
// it's runtime that would otherwise processed through "file" loader.
// Also exclude `html` and `json` extensions so they get processed
// by webpacks internal loaders.
exclude: [/\.js$/, /\.html$/, /\.json$/,/\.styl$/],
options: {
name: 'static/media/[name].[hash:8].[ext]',
},
},
{
test: /\.styl$/,
loaders: ['style-loader', 'css-loader', 'stylus-loader'],
},