{
test: /.styl/,
use: [
MiniCssExtractPlugin.loader,
‘css-loader’,
{
loader: ‘postcss-loader’,
options: {
sourceMap: true
}
},
‘stylus-loader’
]
}
然后运行
npm run dev:server
server is listening on 0.0.0.0
./client/app.vue?vue&type=style&index=0&id=7752612a&lang=stylus&scoped=true& (./node_modules/mini-css-extract-plugin/dist/loader.js!./node_modules/css-loader!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref–5-2!./node_modules/stylus-loader!./node_modules/vue-loader/lib??vue-loader-options!./client/app.vue?vue&type=style&index=0&id=7752612a&lang=stylus&scoped=true&)
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
TypeError: this[NS] is not a function
at childCompiler.runAsChild (/Users/achilles/yilong/todo/node_modules/mini-css-extract-plugin/dist/loader.js:148:15)
后来又修改为:
plugins: defaultPluins.concat([
new webpack.DefinePlugin({
“process.env.NODE_ENV”: JSON.stringify(JSON.stringify(process.env.NODE_ENV || ‘development’)),
“process.env.VUE_ENV”: ‘“server”’
}),
new VueServerPlugin(),
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: ‘[name].[hash].css’,
chunkFilename: ‘[id].[hash].css’
})
//new webpack.HotModuleReplacementPlugin()
// new webpack.NoEmitOnErrorsPlugin()
])
也还是没又样式。。。
登录后可查看更多问答,登录/注册