-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
47 lines (43 loc) · 1.23 KB
/
rollup.config.js
File metadata and controls
47 lines (43 loc) · 1.23 KB
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
import esbuild from 'rollup-plugin-esbuild';
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import jsx from 'acorn-jsx';
import babel from '@rollup/plugin-babel';
const name = 'index';
const bundle = (config) => ({
...config,
input: './packages/segment-next-js/index.ts',
external: (id) => !/^[./]/.test(id),
});
const config = [
bundle({
acornInjectPlugins: [jsx()],
plugins: [
commonjs({
include: 'node_modules/**',
}),
babel({
extensions: ['.js', '.jsx', '.ts', '.tsx'],
presets: ['@babel/preset-react'],
babelHelpers: 'bundled',
}),
nodeResolve({ extensions: ['.js', '.jsx', '.ts', '.tsx'] }),
typescript(),
esbuild(),
],
output: [
{
file: `./dist/${name}.js`,
format: 'es',
sourcemap: true,
},
{
file: `./dist/${name}.mjs`,
format: 'es',
sourcemap: true,
},
],
}),
];
export default config;