Invalid configuration object. webpack

Invalid configuration object. webpack



npm run dev gives me this error:


Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration has an unknown property 'modules'. These properties are valid:
object mode?, amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, externals?, loader?, module?, name?, node?, output?, optimization?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, serve?, stats?, target?, watch?, watchOptions?
For typos: please correct them.
For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.
Loaders should be updated to allow passing options via loader options in module.rules.
Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
plugins: [
new webpack.LoaderOptionsPlugin(
// test: /.xxx$/, // may apply this only for some modules
options:
modules: …

)
]



webpack.config.js


const path = require("path");
const htmlWebpackPlugin = require("html-webpack-plugin");
module.exports = env =>
const no_dist = env && env.dist === "false";

return
//webpack configuration
entry: ["@babel/polyfill", "./src/js/index.js"],
output:
path: path.resolve(__dirname, "dist"),
filename: "js/bundle.js"
,
mode: "development",
devServer:
inline: false,
contentBase: "./dist"
,
plugins: [
new htmlWebpackPlugin(
filename: "index.html",
template: "./src/index.html"
)
],
modules:
rules: [

test: /.js$/,
exclude: /node_modules/,
use:
loader: "babel-loader"


]

;
;



package.json



"name": "espn_project",
"version": "1.0.0",
"description": " project ",
"main": "index.js",
"scripts":
"dev": "webpack --mode development --env.dist=false",
"dev:dist": "webpack --mode development",
"build": "webpack --mode production",
"start": "webpack-dev-server --mode development --open"
,
"author": "Chris Kelly",
"license": "ISC",
"devDependencies":
"@babel/core": "^7.0.1",
"@babel/preset-env": "^7.0.0",
"babel-loader": "^8.0.2",
"html-webpack-plugin": "^3.2.0",
"webpack": "^4.18.0",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.8"
,
"dependencies":
"@babel/polyfill": "^7.0.0"




.babelrc



"presets": ["/env"]




1 Answer
1



As the error message says:



configuration has an unknown property 'modules'. These properties are valid: object { mode?, amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, externals?, loader?, module? ...



It is telling you that you have a property called modules that isn't valid. The correct property name is module (without the "s").


modules


module



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)