Run webpack to report an error: Cannot read property 'presetToOptions' of undefined

attempt to package a new project after installing npm, webpack and webpack-cli, and the error is as follows:

clipboard.png

:

clipboard.png

webpack.config.js is as follows:

module.exports = {
  entry: [
    "./src/js/index.js",
    "./src/js/test.js",
    "./src/js/test2.js",
  ],
  output: {
    filename: "build.min.js"
  }
};

could you tell me how to solve the problem? Using webpack 4

Mar.24,2021

should be related to, npm install-D webpack- g caused by the command used during installation. Reinstall webpack, webpack-cli, and other plug-ins all use npm install XXX-g.

Menu