-
Notifications
You must be signed in to change notification settings - Fork 8
/
third-parties.js
92 lines (88 loc) · 2.38 KB
/
third-parties.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/**
* Record all third-party dependencies that need to be served by CDN.
*
* 1. All these JS dependencies would not be handled by webpack when production
* building.
* 2. ONLY SUPPORT UMD js libraries;
* 3. Pure CSS libraries should work with __DEV__ and require() for
* tree-shaking.
*
* {
* name: '', // required for js, npm package name
* library: '', // required for js, global variable name in the browser
* js: '', // js cdn file urls
* css: '' // css cdn file urls
* }
*/
const thirdParties = [
{
name: 'vue',
library: 'Vue',
js: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js'
},
{
name: 'vue-router',
library: 'VueRouter',
js: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-router.min.js'
},
{
name: 'vuex',
library: 'Vuex',
js: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/vuex.min.js'
},
{
name: 'axios',
library: 'axios',
js: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/axios.min.js'
},
{
name: 'vuex-persistedstate',
library: 'createPersistedState',
js:
'https://cdn.jsdelivr.net/npm/[email protected]/dist/vuex-persistedstate.umd.js'
},
// FIXME: duplicated importation
// {
// name: 'vuetify',
// library: 'Vuetify',
// js: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.min.js',
// css: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.min.css'
// },
{
css:
'https://cdn.jsdelivr.net/npm/[email protected]/dist/material-design-icons.min.css'
},
{
css:
'https://cdn.jsdelivr.net/npm/[email protected]/css/roboto/roboto-fontface.min.css'
},
{
css: 'https://cdn.jsdelivr.net/npm/[email protected]/normalize.min.css'
}
]
// DO NOT MODIFY the following codes if you don't know what's going on.
// use to be webpackConfig.externals
// https://webpack.js.org/configuration/externals/
const externals = {}
// inject these urls to html template
const urls = thirdParties.reduce(
(urls, library) => {
if (library.js) {
urls.js.push(library.js)
}
if (library.css) {
urls.css.push(library.css)
}
// set webpackConfig.externals
if (library.js && library.name && library.library) {
externals[library.name] = library.library
}
return urls
},
{
js: [],
css: []
}
)
exports.externals = externals
exports.thirdPartiesUrls = urls