|
代码;
output:{
path:'./dist'
filename:'index.js'
},错误信息: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" is not an absolute path! -> The output directory as **absolute path** (required). 原因:输出的路径需要时绝对路径 解决方案: 方案一:使用__dirname表示当前文件的绝对路径 这个东西是node自带的 output:{
path:__dirname+'/dist',
filename:'index.js'
},方案二:node自带了一个处理路径的模块 const path=require('path');
output:{
path:path.resolve(__dirname,'dist'),
filename:'index.js'
},参考:http://ke.gxaedu.com/course/186 |
|
|