我刚进入Webpack,参加了在线教程。
每当我运行npm run dev
时,网络包都没有运行,并向我显示错误:Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.output has an unknown property 'fileName'. These properties are valid:
object { auxiliaryComment?, chunkFilename?, webassemblyModuleFilename?, globalObject?, crossOriginLoading?, jsonpScriptType?, chunkLoadTimeout?, devtoolFallbackModuleFilenameTemplate?, devtoolLineToLine?, devtoolModuleFilenameTemplate?, devtoolNamespace?, filename?, hashDigest?, hashDigestLength?, hashFunction?, hashSalt?, hotUpdateChunkFilename?, hotUpdateFunction?, hotUpdateMainFilename?, jsonpFunction?, chunkCallbackName?, library?, libraryTarget?, libraryExport?, path?, pathinfo?, publicPath?, sourceMapFilename?, sourcePrefix?, strictModuleExceptionHandling?, umdNamedDefine? }
-> Options affecting the output of the compilation.
{输出{1}}
以下是我的文件:
options tell webpack how to write the compiled files to disk.
package.json
{
"name": "forkify",
"version": "1.0.0",
"description": "Forkify Project",
"main": "index.js",
"scripts": {
"dev": "webpack"
},
"author": "Sanjay",
"license": "ISC",
"devDependencies": {
"webpack": "^4.12.0",
"webpack-cli": "^3.0.8"
},
"dependencies": {}
}
webpack.config.js
答案 0 :(得分:1)
您的输出对象是错误的。 (fileName => filename)
const path = require('path');
module.exports = {
entry: './src/js/index.js',
output: {
path: path.resolve(__dirname, 'dist/js'),
filename: 'bundle.js'
},
mode: 'development'
}