-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
66 lines (61 loc) · 2.05 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
import resolve from 'rollup-plugin-node-resolve';
import sizes from 'rollup-plugin-sizes';
import filesize from 'rollup-plugin-filesize';
import babel from 'rollup-plugin-babel';
import minifyPreset from 'babel-preset-minify';
export default {
input: 'i18n.js',
output: {
file: 'test/build/i18n.bundled-not-usable-as-it-is.js',
format: 'esm',
},
plugins: [
resolve({
modulesOnly: true,
}),
babel({
sourceMaps: false,
comments: false,
plugins: [
'@babel/plugin-syntax-object-rest-spread',
'@babel/plugin-syntax-async-generators',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-syntax-import-meta',
// rollup rewrites import.meta.url, but makes them point to the file location after bundling
// we want the location before bundling
[ 'bundled-import-meta', {
'mappings': {
'node_modules': '/node_modules'
},
'bundleDir': '.',
'importStyle': 'esm',
} ],
],
presets: [
minifyPreset({}, {
// Options from polymer-build/src/js-transform.ts
// Disable the minify-constant-folding plugin because it has a bug relating
// to invalid substitution of constant values into export specifiers:
// https://github.com/babel/minify/issues/820
evaluate: false,
// TODO(aomarks) Find out why we disabled this plugin.
simplifyComparisons: false,
// Prevent removal of things that babel thinks are unreachable, but sometimes
// gets wrong: https://github.com/Polymer/tools/issues/724
deadcode: false,
// Disable the simplify plugin because it can eat some statements preceeding
// loops. https://github.com/babel/minify/issues/824
simplify: false,
// This is breaking ES6 output. https://github.com/Polymer/tools/issues/261
mangle: false,
}),
],
}),
sizes({
details: true,
}),
filesize({
showBrotliSize: true,
}),
]
}