-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathindex.js
More file actions
48 lines (43 loc) · 1.13 KB
/
index.js
File metadata and controls
48 lines (43 loc) · 1.13 KB
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
module.exports = (api, opts, rootOptions) => {
const utils = require('./utils')(api)
api.extendPackage({
dependencies: {
'element-ui': '^2.4.5'
}
})
api.injectImports(utils.getMain(), `import './plugins/element'`)
api.render({
'./src/plugins/element.js': './templates/src/plugins/element.js',
'./src/App.vue': './templates/src/App.vue'
})
if (opts.import === 'partial') {
api.extendPackage({
devDependencies: {
'babel-plugin-component': '^1.1.1'
}
})
} else if (opts.customTheme) {
api.render({
'./src/element-variables.scss': './templates/src/element-variables.scss'
})
api.extendPackage({
devDependencies: {
'sass-loader': '^7.0.3',
'node-sass': '^4.9.2'
}
})
}
api.onCreateComplete(() => {
if (opts.import === 'partial') {
utils.updateBabelConfig(cfg => {
const pluginComponent = ['component', {
'libraryName': 'element-ui',
'styleLibraryName': 'theme-chalk'
}]
cfg.plugins = cfg.plugins || []
cfg.plugins.push(pluginComponent)
return cfg
})
}
})
}