配置vue-loader后依然报错
npm run build 报错如下:
ERROR in ./src/app.vue
Module build failed (from ./node_modules/vue-loader/dist/index.js):
Error: vue-loader requires @vue/compiler-sfc to be present in the dependency tre
e.
npm run build 报错如下:
ERROR in ./src/app.vue
Module build failed (from ./node_modules/vue-loader/dist/index.js):
Error: vue-loader requires @vue/compiler-sfc to be present in the dependency tre
e.
2020-06-26
检查你的vue-loader版本,v15版本要加一个plugins。在webpack.config.js中配置
const path = require('path');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = {
entry: path.join(__dirname, 'src/index.js'),
output: {
filename: 'bundle.js',
path: path.join(__dirname, 'dist')
},
plugins: [
new VueLoaderPlugin()
],
mode: 'development',
module: {
rules: [
{
test: /.vue$/,
loader: 'vue-loader'
}
]
}
}
举报