用webpack --config build/webpack.base.conf.js命令运行后提示如下:
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.module has an unknown property 'rule'. These properties are valid:
object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, noParse?, rules?, defaultRules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp?, strictExportPresence?, strictThisContextOnImports? }
-> Options affecting the normal modules (`NormalModuleFactory`).
我的webpack.base.conf.js如下:
'use strict';
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
index: [
path.resolve(__dirname,'../src/main.js')
]
},
output: {
path: path.resolve(__dirname,'../dist/static'),
filename: '[name].[hash:8].js',
publicPath: 'static/'
},
module: {
rule: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.js$/,
loader: 'babel-loader?presets=es2015',
exclude: /node_modules/
}
]
},
resolve: {
extensions: ['.js','.vue'],
alias: {
'vue$':'vue/dist/vue.esm.js'
}
},
plugins: [
new HtmlWebpackPlugin({
filename: '../index.html',
template: path.resolve(__dirname,'../index.html')
})
]
}
看错误不像是路径问题,第一次不用vue-cli,一步步搭建项目结构,出这个错误,实在不懂
webpack 不同版本配置参数是不一样的,你的问题就在这里