08335 / hivui-platform-template
hivui平台项目模板
Newer
Older
hivui-platform-template / build / webpack.dll.conf.js
caibinghong on 28 Feb 2022 js-md5
var path = require("path");
var webpack = require("webpack");
const CleanWebpackPlugin = require('clean-webpack-plugin');
debugger
module.exports = {
    mode: 'production',
    // devtool: 'cheap-module-source-map',
    externals: {
        'vue': 'Vue',
        'vuex': 'Vuex',
        'vue-router': 'VueRouter',
        "element-ui": "ELEMENT",
    },
    // 你想要打包的模块的数组
    entry: {
        // vue_vendors: [
        //     'vue/dist/vue.esm.js',
        //     'vue-router',
        //     'vuex/dist/vuex.esm.js',
        //     'element-ui'
        // ],
        vendor: [
            'babel-polyfill', //提前打包一些基本不怎么修改的文件
            'axios',
            'js-cookie',
            'js-md5',
            'lodash',
        ]
    },
    output: {
        path: path.join(__dirname, '../assets_platform/vendor_dll'), // 打包后文件输出的位置
        filename: '[name].dll.js',
        library: '[name]_library'
        // vendor.dll.js中暴露出的全局变量名。
        // 主要是给DllPlugin中的name使用,
        // 故这里需要和webpack.DllPlugin中的`name: '[name]_library',`保持一致。
    },
    plugins: [
        new CleanWebpackPlugin(['../assets_platform/vendor_dll']),
        new webpack.DllPlugin({
            path: path.join(__dirname, '../assets_platform/vendor_dll', '[name]-manifest.json'),
            name: '[name]_library',
            context: __dirname
        }),
    ],
};