我會通過在線課程,當我嘗試運行我的服務器我得到這個錯誤,但不能明白爲什麼:WebpackOptionsValidationError:無效的配置對象
/應用/ XAMPP/xamppfiles/htdocs中/項目/distdesign/node_modules/webpack/lib/webpack.js:19 拋出新的WebpackOptionsValidationError(webpackOptionsValidationErrors); ^
WebpackOptionsValidationError:無效的配置對象。 Webpack已使用與API模式不匹配的配置對象進行初始化。 - 配置有一個未知屬性'devtools'。這些屬性是有效的: object {amd?,bail?,cache ?, context?,dependencies ?, devServer ?, devtool?,entry,externals ?, loader ?, module ?, name ?, node ?, output ?, parallelism ?,性能?,插件?,配置文件?,recordsInputPath?,recordsOutputPath?,recordsPath ?,解析?,resolveLoader?,stats?,target?,watch ?, watchOptions? } 對於錯別字:請更正它們。 對於加載器選項:webpack 2不再允許配置中的自定義屬性。 應該更新加載器以允許通過module.rules中的加載器選項傳遞選項。 直到裝載機更新一個可以使用LoaderOptionsPlugin通過這些選項裝載機: 插件:[ 新webpack.LoaderOptionsPlugin({// 測試:/.xxx$/,//可以應用此僅針對某些模塊 選項:{ devtools:... }} ) ] - configuration.resolve.extensions [0]不應該是空的。 at webpack(/Applications/XAMPP/xamppfiles/htdocs/projects/distdesign/node_modules/webpack/lib/webpack.js:19:9) at Object。 (/Applications/XAMPP/xamppfiles/htdocs/projects/distdesign/server/index.js:9:27) at Module._compile(module.js:573:30) at loader(/ Applications/XAMPP/xamppfiles/htdocs /projects/distdesign/node_modules/babel-register/lib/node.js:144:5) at Object.require.extensions。(anonymous function)[as .js](/ Applications/XAMPP/xamppfiles/htdocs/projects /在module.load(module.js:507:32) 在tryModuleLoad(module.js:470:12) (在Function.Module中):distdesign/node_modules/babel-register/lib/node.js:154:7) 。 _load(module.js:462:3) at Function.Module.runMain(module.js:609:10) at Object。 (/Applications/XAMPP/xamppfiles/htdocs/projects/distdesign/node_modules/babel-cli/lib/_babel-node.js:154:22) [nodemon]應用程序崩潰 - 在啓動之前等待文件更改...
這是我的WebPack配置文件:
import path from 'path';
export default {
devtools: 'eval-source-map',
entry: path.join(__dirname, '/client/index.js'),
output: {
path: '/'
},
module: {
loaders: [
{
test: /\.js$/,
include: path.join(__dirname, 'client'),
loaders: [ 'babel' ]
}
]
},
resolve: {
extensions: [ '', '.js' ]
}
}