Browse Source
Merge pull request #284 from xiaopenggithub/master
前端发布优化,部分组件使用cdn资源,不打包
main
奇淼(piexlmax
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
16 additions and
0 deletions
-
web/public/index.html
-
web/vue.config.js
|
|
@ -8,6 +8,11 @@ |
|
|
|
<meta name="viewport" content="width=device-width,initial-scale=1.0"> |
|
|
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> |
|
|
|
<title>GIN-VUE-ADMIN</title> |
|
|
|
<% if(process.env.NODE_ENV!=='development'){ %> |
|
|
|
<script src="//cdn.staticfile.org/vue/2.6.10/vue.min.js"></script> |
|
|
|
<script src="//cdn.staticfile.org/axios/0.19.0/axios.min.js"></script> |
|
|
|
<script src="//cdn.staticfile.org/echarts/4.7.0/echarts.min.js"></script> |
|
|
|
<% } %> |
|
|
|
</head> |
|
|
|
|
|
|
|
<body> |
|
|
|
|
|
@ -59,6 +59,17 @@ module.exports = { |
|
|
|
config |
|
|
|
.when(process.env.NODE_ENV !== 'development', |
|
|
|
config => { |
|
|
|
|
|
|
|
// 不打包 begin
|
|
|
|
// 1.目前已经测试通过[vue,axios,echarts]可以cdn引用,其它组件测试通过后可继续添加
|
|
|
|
// 2.此处添加不打包后,需在public/index.html head中添加相应cdn资源链接
|
|
|
|
config.set('externals', { |
|
|
|
vue: 'Vue', |
|
|
|
axios: 'axios', |
|
|
|
echarts: 'echarts' |
|
|
|
}) |
|
|
|
// 不打包 end
|
|
|
|
|
|
|
|
config |
|
|
|
.plugin('ScriptExtHtmlWebpackPlugin') |
|
|
|
.after('html') |
|
|
|