-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
54 lines (51 loc) · 1.22 KB
/
rollup.config.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
const scss = require('rollup-plugin-scss')
const VuePlugin = require('rollup-plugin-vue')
const BabelPlugin = require('rollup-plugin-babel')
const commonjs = require('@rollup/plugin-commonjs')
const alias = require('@rollup/plugin-alias')
const fs = require('fs')
const buildConfigs = []
const files = fs.readdirSync('./src/icons')
let scssOutput = `./lib/icon.css`;
files.forEach((name) => {
const pkgConfig = {
external: ['vue'],
input: './src/icons/' + name,
output: {
file: `./lib/${name.replace(/\.vue$/, '')}.js`,
format: 'es',
name,
globals: {
vue: 'Vue'
}
},
plugins: [
alias({
resolve: ['.js', '.jsx', '.vue'],
}),
VuePlugin({
css: false,
template: {
isProduction: true,
}
}),
BabelPlugin(
{
exclude: 'node_modules/**',
extensions: ['.js', '.jsx', '.vue'],
presets: [
['@babel/preset-env',]
]
}
),
commonjs(),
scss({
output: scssOutput
}),
]
}
// 只输出一次
scssOutput = false
buildConfigs.push(pkgConfig)
})
module.exports = buildConfigs