-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.dev.config.js
56 lines (52 loc) · 1.46 KB
/
rollup.dev.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
import commonjs from 'rollup-plugin-commonjs';
import copy from 'rollup-plugin-copy';
import replace from 'rollup-plugin-replace';
import serve from 'rollup-plugin-serve';
import typescript from 'rollup-plugin-typescript2';
import { getBasePlugins } from './rollup.config';
export default (commandLineArgs) => {
const targetFolder = commandLineArgs.configDocBuild ? 'docs' : 'dist';
const config = {
input: 'src/demo.tsx',
output: [
{
file: `${targetFolder}/demo.js`,
format: 'iife',
sourcemap: true,
},
],
plugins: [
...getBasePlugins(targetFolder),
commonjs({
include: ['node_modules/**'],
namedExports: {
'node_modules/react/index.js': [
'Children',
'Component',
'PropTypes',
'createElement',
],
'node_modules/react-dom/index.js': ['render'],
},
}),
typescript({
rollupCommonJSResolveHack: true,
clean: true,
tsconfigOverride: {
compilerOptions: { declaration: false },
include: ['src/index.tsx', './src/types.d.ts', 'src/demo.tsx'],
},
}),
copy({
targets: [{ src: 'src/templates/index.html', dest: targetFolder }],
}),
replace({
'process.env.NODE_ENV': JSON.stringify('development'),
}),
],
};
if (!commandLineArgs.configDocBuild) {
config.plugins.push(serve(targetFolder));
}
return config;
};