Beginning with webpack error The 'mode' option has not been set,

An error

The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
 

solve

Added package.json

"dev": "webpack --mode development", "build": "webpack --mode production"

Then rebuild a file named webpack.config.js (position on the map directory)

Write

const  path=require("path");
module.exports = {
    entry: "./src/main.js",// entry file path
    output: {
        path: path.resolve (__ dirname, 'file placed after the processing path ./dist'),//
        filename: "b.js" // This file name
    },
    mode: 'development'
}

Guess you like

Origin blog.csdn.net/qq_39485970/article/details/93738392