-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.mjs
33 lines (31 loc) · 931 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
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import json from "@rollup/plugin-json";
const isProduction = process.env.BUILD === 'production';
export default {
input: isProduction ? 'src/index.ts' : 'src/tests/index.ts',
output: {
//dir: 'dist',
file: isProduction ? 'dist/index.cjs' : 'dist/tests/index.cjs',
format: 'cjs',
sourcemap: true
},
external: [
"@serialport/bindings-cpp",
],
plugins: [
nodeResolve({
preferBuiltins: true
}),
commonjs({
ignoreDynamicRequires: true,
}),
typescript({
tsconfig: isProduction ? 'tsconfig.json' : 'tsconfig.tests.json',
}),
isProduction && terser(),
json(),
],
};