亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

按照老師的寫webpack.config.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/js" is not an absolute path!

有沒有大神知道這個是為啥啊

正在回答

9 回答

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'

}

}


0 回復 有任何疑惑可以回復我~

我這個問題前面跟你的錯誤一樣,后面就不一樣了。不知道怎么改。

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? }


0 回復 有任何疑惑可以回復我~
#1

快樂的小牛妞

你是不是用的loaders ,改成rules
2018-12-05 回復 有任何疑惑可以回復我~
path:?"./dist/js"
改為:
path:?__dirname?+"/dist/js"


3 回復 有任何疑惑可以回復我~

webpack版本的問題,可以改成path: __dirname + '/dist/js',

2 回復 有任何疑惑可以回復我~

直接

path: path.resolve(__dirname, 'dist'),

不要./dist

0 回復 有任何疑惑可以回復我~

少了個? var path = require('path') 的引入

0 回復 有任何疑惑可以回復我~
#1

狂龍治中

看錯了。。。
2017-07-16 回復 有任何疑惑可以回復我~

./dist/js 把前面一點去了也可以?/dist/js?

1 回復 有任何疑惑可以回復我~
#1

向前走不回頭 提問者

嗯嗯,我加了.之后輸出到項目外面去了,把.去了之后就好了,謝謝啊
2017-07-14 回復 有任何疑惑可以回復我~

也可能你沒有建dist這個文件夾

0 回復 有任何疑惑可以回復我~

output:{

????path:路徑錯誤

}

不知道是不是,把代碼復制出來看看,比較容易看那里錯了

0 回復 有任何疑惑可以回復我~
#1

向前走不回頭 提問者

找到原因了,path路徑錯了
2017-07-14 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

按照老師的寫webpack.config.js后運行報錯

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號