Creating Webpack 4.X project

Creating a basic project webpack4.x

  1. Run npm init -yfast initialization Project

  2. Created in the root directory of the project srcsource code directory and distproduct catalog

  3. Created in the src directory index.html

  4. Use cnpm installation webpack, runcnpm i webpack webpack-cli -D

    • How to install cnpm: a global runnpm i cnpm -g

  5. Note: webpack 4.x greater than the convention provides a conceptual configuration; purpose is to minimize the volume of the configuration file;

    • Default agreed:

    • Entrance is packaged src->index.js

    • The output file is packaged dist->main.js

    • 4.x added a modeoption (as required), optional value: developmentand production;

Guess you like

Origin www.cnblogs.com/it-Ren/p/11408862.html