1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- const { defineConfig } = require("@vue/cli-service");
- const timestamp = new Date().getTime();
- //生产环境标记
- const IS_PRODUCTION = process.env.NODE_ENV === "production";
-
- // 生产配置
- const cdn_production = {
- js: ["/librarys/vue@2.6.11/vue.min.js"]
- };
- // 开发配置
- const cdn_development = {
- js: ["/librarys/vue@2.6.11/vue.js"]
- };
- module.exports = defineConfig({
- lintOnSave: false,
- productionSourceMap: !IS_PRODUCTION, //打包不生成map文件
- devServer: {
- open: false
- },
- css: {
- extract: IS_PRODUCTION
- ? {
- filename: `css/[name].${timestamp}.css`,
- chunkFilename: `css/[name].${timestamp}.css`
- }
- : false,
- loaderOptions: {
- less: {
- lessOptions: {
- javascriptEnabled: true
- }
- }
- }
- },
- configureWebpack: {
- output: {
- filename: `js/[name].${timestamp}.js`,
- chunkFilename: `js/[name].${timestamp}.js`
- },
- // 排除不引用
- externals: {
- vue: "Vue",
- "vue-router": "VueRouter",
- vuex: "Vuex",
- echarts: "echarts",
- axios: "axios",
- xlsx: "XLSX2",
- "xlsx-style": "XLSX",
- "view-design": "iview",
- "crypto-js": "CryptoJS"
- }
- },
- chainWebpack: (config) => {
- config.plugin("html").tap((args) => {
- args[0].cdn = IS_PRODUCTION ? cdn_production : cdn_development;
- return args;
- });
- }
- });
|