-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
78 lines (75 loc) · 1.83 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
67
68
69
70
71
72
73
74
75
76
77
78
// rollup.config.js
import json from '@rollup/plugin-json'
import {terser} from 'rollup-plugin-terser'
import bubleP from '@rollup/plugin-buble'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import babelP from '@rollup/plugin-babel'
import injectProcessEnv from 'rollup-plugin-inject-process-env'
import yaml from '@rollup/plugin-yaml'
const buble = bubleP({
objectAssign: 'Object.assign',
transforms:{
// modules: false // default is false since this is rollup plugin
arrow: false,
classes: false,
computedProperty: true,
conciseMethodProperty: true,
dangerousForOf: true,
dangerousTaggedTemplateString: false,
defaultParameter: true,
destructuring: true,
forOf: true,
generator: false,
letConst: true,
numericLiteral: true,
parameterDestructuring: true,
reservedProperties: false,
spreadRest: true,
stickyRegExp: true,
templateString: false,
unicodeRegExp: true
}
})
const babel = babelP({
babelrc: false,
babelHelpers: 'bundled',
plugins: [
'babel-plugin-transform-async-to-promises',
]
})
export default {
input: './main.js',
plugins: [
resolve(),
commonjs(),
babel,
yaml(),
json(),
injectProcessEnv({
PRODUCTION: !!process.env.PRODUCTION || !!process.env.PRO || false
}),
buble,
],
output: [
{
file: './build/espruino.dev.js',
format: 'cjs',
interop: false
// external: [ 'Wifi' ] // <-- suppresses the warning
},
{
file: './build/espruino.js',
format: 'cjs',
interop: false,
// external: [ 'Wifi' ], // <-- suppresses the warning
plugins: [terser()]
},
{
file: './build/esm.js',
format: 'es',
interop: false,
// external: [ 'Wifi' ] // <-- suppresses the warning
},
],
}