-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
rollup.config.js
66 lines (62 loc) · 1.39 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
55
56
57
58
59
60
61
62
63
64
65
66
const path = require('path')
const merge = require('deepmerge')
const { defineConfig } = require('rollup')
const resolve = require('rollup-plugin-node-resolve')
const babel = require('@rollup/plugin-babel').default
const replace = require('@rollup/plugin-replace')
const { terser } = require('rollup-plugin-terser')
const vue = require('rollup-plugin-vue')
const typescript = require('rollup-plugin-typescript')
const pkg = require('./package.json')
const baseConfig = defineConfig({
external: ['vue'],
input: path.resolve('./packages/index.ts'),
plugins: [
replace({
values: {
__VERSION__: pkg.version
},
preventAssignment: true
}),
typescript(),
vue(),
resolve(),
babel({
exclude: 'node_modules/**',
babelHelpers: 'bundled'
})
],
output: {
name: 'Vue3baiduMapGl',
format: 'umd',
exports: 'named',
globals: {
vue: 'Vue'
}
}
})
const devConfig = defineConfig({
output: {
file: path.resolve('dist/index.js')
}
})
const prodConfig = defineConfig({
plugins: [
replace({
values: {
'process.env.NODE_ENV': JSON.stringify('production')
},
preventAssignment: true
}),
terser()
],
output: {
file: path.resolve('dist/index.prod.js')
}
})
module.exports = [
// dev umd output
merge(baseConfig, devConfig),
// prod umd output
merge(baseConfig, prodConfig)
]