-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.mjs
42 lines (40 loc) · 1020 Bytes
/
rollup.config.mjs
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
import { nodeResolve } from '@rollup/plugin-node-resolve';
import { babel } from '@rollup/plugin-babel';
const createBuild = ({
inPath = '',
outPath = inPath,
inFile = 'index.ts',
outFile = 'index.js'
} = {}) => ({
external: ['react', 'react-dom', 'use-sync-external-store/shim', 'immer'],
plugins: [
nodeResolve({ extensions: ['.ts', '.tsx', '.js', '.jsx'] }),
babel({
babelHelpers: 'bundled',
extensions: ['.ts', '.tsx', '.js', '.jsx']
})
],
treeshake: {
moduleSideEffects: false,
propertyReadSideEffects: false
},
input: `src/${inPath}${inFile}`,
output: [
{
file: `dist/${outPath}cjs/${outFile}`,
format: 'cjs',
interop: 'default'
},
{
dir: `dist/${outPath}esm`,
format: 'es',
preserveModules: true
}
]
});
export default [
createBuild(),
createBuild({ inPath: 'middleware/' }),
createBuild({ inPath: 'middleware/', inFile: 'immer.ts', outFile: 'immer.js' }),
createBuild({ inPath: 'plugin/' })
];