What is the packaging process of webpack?

1. Initialize a management package
yarn init


2. Install the dependency package yarn add webpack webpack-cli -D required to install and use webpack

3. Configure scripts (custom commands) in the package.json file
scripts: {     "build": "webpack" }

4. Import the newly created packaging file into the default packaging entry src/index.js of webpack


5. Execute the yarn build command in the root directory to package
 

 

After executing the packaging command:

webpack will first go to webpack.config.js to find out whether there is a custom command to change the entry and exit positions.

If there is, the command in the configuration file will be executed, if not, the default command will be executed.

Then start packaging according to dependencies.

[Note] All resources that want to be packaged must have a direct/indirect relationship with the "entry file" before they can be packaged, otherwise they will not be packaged

[Note] The default entry of webpack packaging: src/index.js file; the default exit: dist/main.js

If you are interested, you can read more information, thank you 

Guess you like

Origin blog.csdn.net/m0_71231013/article/details/125365840
Recommended