-
Notifications
You must be signed in to change notification settings - Fork 12
/
rollup.config.ts
43 lines (39 loc) · 1 KB
/
rollup.config.ts
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
import commonjs from '@rollup/plugin-commonjs';
import less from 'rollup-plugin-less';
import replace from '@rollup/plugin-replace';
import resolve from '@rollup/plugin-node-resolve';
import swc from 'rollup-plugin-swc';
import packageJson from './package.json';
const plugins = [
less({ output: './dist/viewer.css' }),
resolve({
preferBuiltins: true,
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
}),
commonjs(),
replace({
values: {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
__VERSION__: JSON.stringify(packageJson.version),
},
preventAssignment: true,
}),
swc(),
];
const globals = {
react: 'React',
'react-dom': 'ReactDOM',
};
export default {
input: {
index: 'src/index.ts',
differ: 'src/differ.ts',
viewer: 'src/viewer.tsx',
},
output: [
{ dir: './dist', format: 'esm', globals, exports: 'auto' },
{ dir: './dist/cjs', format: 'cjs', globals, exports: 'auto' },
],
external: ['react', 'react-dom'],
plugins,
};