leiyanting

导航

 
拒绝打包,但是这样拒绝打包后(cdn链接方式引入)必须要在index.html中引入
                const { resolve } = require('path');
                const HtmlWebpackPlugin = require('html-webpack-plugin');

                module.exports = {
                entry: './src/js/index.js',
                output: {
                    filename: 'js/built.js',
                    path: resolve(__dirname, 'build')
                },
                plugins: [
                    new HtmlWebpackPlugin({
                    template: './src/index.html'
                    })
                ],
                mode: 'production',
                externals: {
                    // 拒绝jQuery被打包进来
                    jquery: 'jQuery'
                }
                };

 

posted on 2021-10-25 08:20  leiyanting  阅读(45)  评论(0)    收藏  举报