-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
53 lines (47 loc) · 1.23 KB
/
rollup.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
import path from 'path';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
import commonjs from '@rollup/plugin-commonjs';
import replace from '@rollup/plugin-replace';
import packageJson from './package.json';
const paths = {};
paths.root = path.resolve(__dirname, '.');
paths.nodeModules = path.join(paths.root, 'node_modules');
paths.src = path.join(paths.root, 'src');
paths.entryPoint = path.join(paths.src, 'index.tsx');
const external = Object.keys(packageJson.peerDependencies).concat(['util']);
export default {
input: paths.entryPoint,
output: [
{
file: packageJson.main,
format: 'cjs',
exports: 'named',
sourcemap: true
},
{
file: packageJson.module,
format: 'esm',
exports: 'named',
sourcemap: true
}
],
external,
plugins: [
replace({
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
nodeResolve({
browser: true,
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
moduleDirectory: ['node_modules', paths.src],
}),
typescript({
clean: true
}),
commonjs({
include: /node_modules/,
}),
],
};