错误是
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.output.path: The provided value "./dist/js" is not an absolute path!
有没有大神知道这个是为啥啊
var htmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
module.exports = {
entry: './src/script/main.js',
output:{
path:path.resolve(__dirname,'./dist/js'),
filename:'[name].js'
}
}
我这个问题前面跟你的错误一样,后面就不一样了。不知道怎么改。
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.module.rules[3].use should be one of these:
non-empty string | function | object { ident?, loader?, options?, query? } | function | [non-empty string | function | object { ident?, loader?, options?, query? }]
-> Modifiers applied to the module when rule is matched
Details:
* configuration.module.rules[3].use should be a string.
* configuration.module.rules[3].use should be an instance of function
* configuration.module.rules[3].use should be an object.
* configuration.module.rules[3].use should be an instance of function
* configuration.module.rules[3].use[0] should be a string.
* configuration.module.rules[3].use[0] should be an instance of function
* configuration.module.rules[3].use[0] has an unknown property 'option'. These properties are valid:
object { ident?, loader?, options?, query? }
path: "./dist/js" 改为: path: __dirname +"/dist/js"
webpack版本的问题,可以改成path: __dirname + '/dist/js',
直接
path: path.resolve(__dirname, 'dist'),
不要./dist
少了个 var path = require('path') 的引入
./dist/js 把前面一点去了也可以 /dist/js
也可能你没有建dist这个文件夹
output:{
path:路径错误
}
不知道是不是,把代码复制出来看看,比较容易看那里错了