|  |  | @@ -1,12 +1,41 @@ | 
		
	
		
			
			|  |  |  | // const UglifyJsPlugin = require('uglifyjs-webpack-plugin') | 
		
	
		
			
			|  |  |  | const path = require('path'); | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | let externals = {} | 
		
	
		
			
			|  |  |  | let cdn = { css: [], js: [] } | 
		
	
		
			
			|  |  |  | const isProduction = process.env.VUE_APP_ENV == 'production' // 判断是否是生产环境 | 
		
	
		
			
			|  |  |  | if (isProduction) { | 
		
	
		
			
			|  |  |  | externals = { | 
		
	
		
			
			|  |  |  | /** | 
		
	
		
			
			|  |  |  | * externals 对象属性解析: | 
		
	
		
			
			|  |  |  | * '包名' : '在项目中引入的名字' | 
		
	
		
			
			|  |  |  | */ | 
		
	
		
			
			|  |  |  | 'vue': 'Vue', | 
		
	
		
			
			|  |  |  | 'element-ui': 'ELEMENT', | 
		
	
		
			
			|  |  |  | 'xlsx': 'XLSX' | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | cdn = { | 
		
	
		
			
			|  |  |  | css: [ | 
		
	
		
			
			|  |  |  | 'https://unpkg.com/element-ui/lib/theme-chalk/index.css' // element-ui css 样式表 | 
		
	
		
			
			|  |  |  | ], | 
		
	
		
			
			|  |  |  | js: [ | 
		
	
		
			
			|  |  |  | // vue must at first! | 
		
	
		
			
			|  |  |  | 'https://unpkg.com/vue@2.6.12/dist/vue.js', // vuejs | 
		
	
		
			
			|  |  |  | 'https://unpkg.com/element-ui/lib/index.js', // element-ui js | 
		
	
		
			
			|  |  |  | 'https://cdn.jsdelivr.net/npm/xlsx@0.16.6/dist/xlsx.full.min.js' // xlsx | 
		
	
		
			
			|  |  |  | ] | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | module.exports = { | 
		
	
		
			
			|  |  |  | configureWebpack: { | 
		
	
		
			
			|  |  |  | resolve: { | 
		
	
		
			
			|  |  |  | alias: { | 
		
	
		
			
			|  |  |  | '@': path.resolve(__dirname, 'src') | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | externals | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | css: { | 
		
	
		
			
			|  |  |  | loaderOptions: { | 
		
	
	
		
			
				|  |  | @@ -39,7 +68,8 @@ module.exports = { | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | proxy: { | 
		
	
		
			
			|  |  |  | '/api': { | 
		
	
		
			
			|  |  |  | target: 'https://smapitestmalls,iformall.com/C/api', | 
		
	
		
			
			|  |  |  | // target: 'https://smapitestmalls,iformall.com/C/api', | 
		
	
		
			
			|  |  |  | target: process.env.VUE_APP_API_ROOT+'/api', | 
		
	
		
			
			|  |  |  | changeOrigin: true, | 
		
	
		
			
			|  |  |  | pathRewrite: { | 
		
	
		
			
			|  |  |  | '^/api': '' | 
		
	
	
		
			
				|  |  | @@ -56,6 +86,17 @@ module.exports = { | 
		
	
		
			
			|  |  |  | args[0].favicon = './public/favicon.ico'; | 
		
	
		
			
			|  |  |  | return args; | 
		
	
		
			
			|  |  |  | }); | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | // 注入cdn变量 (打包时会执行) | 
		
	
		
			
			|  |  |  | config.plugin('html').tap(args => { | 
		
	
		
			
			|  |  |  | args[0].cdn = cdn // 配置cdn给插件 | 
		
	
		
			
			|  |  |  | return args | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | // configureWebpack: { | 
		
	
		
			
			|  |  |  | //     plugins: [ | 
		
	
	
		
			
				|  |  | 
 |