123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- const { defineConfig } = require('@vue/cli-service')
- const cdn = {
- css: [
- // '//unpkg.com/element-ui@2.10.1/lib/theme-chalk/index.css'
- ],
- js: [
- '//cdn-common.jianyu360.com/cdn/lib/vue/2.6.14/vue.runtime.min.js',
- '//cdn-common.jianyu360.com/cdn/lib/vue-router/3.1.5/vue-router.min.js',
- '//cdn-common.jianyu360.com/cdn/lib/vuex/3.4.0/vuex.min.js',
- '//cdn-common.jianyu360.com/cdn/lib/axios/0.19.2/axios.min.js',
- '//cdn-common.jianyu360.com/cdn/lib/js-cookie/2.2.1/js.cookie.min.js',
- '//cdn-common.jianyu360.com/cdn/lib/moment/2.29.1/min/moment.min.js',
- ]
- }
- const externals = {
- vue: 'Vue',
- 'vue-router': 'VueRouter',
- vuex: 'Vuex',
- axios: 'axios',
- 'js-cookie': 'Cookies',
- moment: 'moment'
- }
- module.exports = defineConfig({
- publicPath: process.env.VUE_APP_BASE_URL,
- outputDir: 'page_pc_stationSocial',
- transpileDependencies: true,
- lintOnSave: true,
- productionSourceMap: false,
- devServer: {
- port: '8080',
- open: false,
- client: {
- overlay: {
- errors: true,
- warnings: false
- }
- },
- historyApiFallback: true,
- proxy: {
- '^/api/userCenter': {
- target: 'http://192.168.3.240:8077',
- changeOrigin: true,
- logLevel: 'debug',
- pathRewrite: {
- '^/api': ''
- }
- },
- '^/api/orderApplication': {
- target: 'http://192.168.21.175:9999',
- changeOrigin: true,
- logLevel: 'debug',
- pathRewrite: {
- '^/api': ''
- }
- },
- '^/api': {
- target: 'http://192.168.3.128:8077',
- changeOrigin: true,
- logLevel: 'debug',
- pathRewrite: {
- '^/api': ''
- }
- }
- }
- },
- css: {
- loaderOptions: {
- sass: {
- additionalData: '@import "@/assets/style/_mixin.scss";@import "@/assets/style/_variables.scss";'
- }
- }
- },
- chainWebpack: config => {
- if (process.env.NODE_ENV === 'production') {
- // 生产环境配置
- config.externals(externals)
- config.plugin('html').tap(args => {
- // html中添加cdn
- args[0].cdn = cdn
- return args
- })
- config.optimization.minimize(true)
- .minimizer('terser')
- .tap(args => {
- const { terserOptions } = args[0]
- terserOptions.compress.drop_console = true
- terserOptions.compress.drop_debugger = true
- return args
- })
- }
- }
- })
|