forked from vuejs/rollup-plugin-vue
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.js
48 lines (45 loc) · 1.04 KB
/
build.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
'use strict'
const babel = require('rollup-plugin-babel')
const rollup = require('rollup')
const pack = require('../package.json')
const dependencies = Object.keys(pack.dependencies).concat('path')
rollup
.rollup({
input: 'src/index.js',
external(id) {
return dependencies.some(it => it === id || id.startsWith(it))
},
plugins: [
babel({
exclude: 'node_modules/**',
babelrc: false,
presets: [
[
'@babel/preset-env',
{
modules: false,
target: { node: 6 }
}
]
],
plugins: [
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-transform-runtime'
],
runtimeHelpers: true
})
]
})
.then(bundle => {
bundle.write({
format: 'cjs',
file: 'dist/' + pack.name + '.common.js',
sourcemap: true
})
bundle.write({
format: 'es',
file: 'dist/' + pack.name + '.js',
sourcemap: true
})
})
.catch(console.error)