-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrollup.config.js
More file actions
78 lines (76 loc) · 2.56 KB
/
rollup.config.js
File metadata and controls
78 lines (76 loc) · 2.56 KB
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
'use strict';
const PeerDepsExternal = require('rollup-plugin-peer-deps-external');
const { nodeResolve: NodeResolve } = require('@rollup/plugin-node-resolve');
const Commonjs = require('rollup-plugin-cjs-es');
const { babel: Babel } = require('@rollup/plugin-babel');
const { terser: Terser } = require('rollup-plugin-terser');
const Filesize = require('rollup-plugin-filesize');
module.exports = [
{
input: 'lib/index.js',
output: [
{
file: 'dist/strange-middle-end.js',
format: 'cjs',
exports: 'named',
sourcemap: true
},
{
file: 'dist/strange-middle-end.module.js',
format: 'esm',
exports: 'named',
sourcemap: true
}
],
external: [/@babel\/runtime/],
plugins: [
PeerDepsExternal(),
NodeResolve(),
Commonjs(),
Babel({
exclude: ['node_modules/**'],
babelHelpers: 'runtime',
plugins: ['@babel/plugin-transform-runtime']
}),
Filesize()
]
},
{
input: 'lib/index.js',
output: {
file: 'dist/strange-middle-end.umd.min.js',
format: 'umd',
name: 'StrangeMiddleEnd',
esModule: false,
exports: 'named',
sourcemap: true,
globals: {
immer: 'immer',
normalizr: 'normalizr',
redux: 'Redux',
'redux-thunk': 'ReduxThunk',
react: 'React'
}
},
// core-js polyfills are imported for node/esm compatibility, so core-js@3.11.x is
// technically a peer for consuming the UMD output those environments e.g. node, but bundled
// for running in-browser
external: [/^core\-js/],
plugins: [
PeerDepsExternal(),
NodeResolve(),
Commonjs(),
Babel({
exclude: ['node_modules/**'],
// babelHelpers and useBuiltIns together result in our used polyfills e.g.
// regenerator-runtime bundled in the output UMD, so it's directly usable
// in-browser (no need to pull in anything from core-js via preceeding
// script tags)
babelHelpers: 'bundled',
presets: [['@babel/env', { useBuiltIns: 'usage', corejs: '3.11' }]]
}),
Terser(),
Filesize()
]
}
];