css文件的 处理有问题
来源:5-3 服务端渲染的entry配置
旋涡鸣人_
2018-10-24
{
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()
])
也还是没又样式。。。
1回答
-
Jokcy
2018-10-24
https://github.com/webpack-contrib/mini-css-extract-plugin/issues/73#issuecomment-380510188
042018-10-29
相似问题