There was a mistake when packing the react project. I was also in the learning stage. Ask for advice.

"scripts": {

"dev": "node_modules/.bin/webpack-dev-server",
"dist": "set WEBPACK_ENV=online&& node_modules/.bin/webpack ",
"dist_mac":  "WEBPACK_ENV=online  node_modules/.bin/webpack "

}
this is the specific configuration of my json file.

clipboard.png
this is my error report after executing dist!

Apr.30,2022

when webpack packages code, the webpack command is usually followed by a configuration file, which means that the configuration file is executed with webpack, for example,

webpack webpack.config.js

in this way, you set the environment variable WEBPACK_ENV and execute node_modules/.bin/webpack directly. When there is no configuration file, you will find webpack.config.js as the configuration file by default. I wonder if you have this file in your project

.
Menu