-
Notifications
You must be signed in to change notification settings - Fork 19
/
rollup.config.dev.js
62 lines (59 loc) · 1.62 KB
/
rollup.config.dev.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
import commonjs from 'rollup-plugin-commonjs';
import injectProcessEnv from 'rollup-plugin-inject-process-env';
import path from 'path';
import resolve from 'rollup-plugin-node-resolve';
import sourcemaps from 'rollup-plugin-sourcemaps';
import typescript from 'rollup-plugin-typescript2';
const externals = {
'react': 'React',
'react-dom': 'ReactDOM',
}
const createConf = (page) => {
return {
input: `./examples/${page}.tsx`,
output: [
{
file: `./dist/js/${page}.js`,
format: 'iife',
sourcemap: true,
name: page.split('-').join('_'),
globals: externals,
}
],
external: Object.keys(externals),
plugins: [
resolve(),
commonjs({
namedExports: {
'examples/node_modules/react-is/index.js': [
'isValidElementType',
'isContextConsumer',
],
'examples/node_modules/use-sync-external-store/shim/with-selector.js': [
'useSyncExternalStoreWithSelector'
],
'examples/node_modules/use-sync-external-store/shim/index.js': [
'useSyncExternalStore'
]
}
}),
typescript({
useTsconfigDeclarationDir: true,
tsconfig: path.resolve(__dirname, './tsconfig.dev.json')
}),
sourcemaps(),
injectProcessEnv({
NODE_ENV: 'production',
OBER_CONFIG: { mode: 'property' },
}),
]
};
};
export default [
createConf('develop'),
createConf('benchmark-mota'),
createConf('benchmark-mota-old'),
createConf('benchmark-redux'),
createConf('benchmark-mobx'),
createConf('benchmark-normal'),
];