| 1234567891011121314151617181920212223242526272829303132 | /** * loader: 1下载 2使用 * plugins:1下载 2引入 3使用 */const {resolve} = require('path')const htmlWebpackPlugin = require('html-webpack-plugin')module.exports = {    entry: './src/index.js',    output:{        filename: 'js/built.js',        path: resolve(__dirname,'build')    },    module:{        rules:[        ]    },    plugins:[        // html-webpack-plugin        // 默认创建一个空的html文件 自动引入打包输出的所有资源(js/css)        // 需要有解构的html文件        new htmlWebpackPlugin({            // 复制该文件,并自动引入打包输出的所有资源            template: './src/index.html'        })    ],    mode:'production',    externals:{        //忽略 库名 -- 包名        jquery: 'jQuery'    }}
 |