-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
rollup.config.mjs
44 lines (41 loc) · 1.06 KB
/
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
43
44
/* eslint-env node */
import pkg from './package.json' assert { type: 'json' };
import esbuild from 'rollup-plugin-esbuild';
import dts from 'rollup-plugin-dts';
import { nodeResolve } from '@rollup/plugin-node-resolve';
const isProd = process.env.NODE_ENV !== 'development';
const config = [
{
input: 'src/gcode-preview.ts', // our source file
output: [
{
file: pkg.main,
format: 'es' // the preferred format
},
{
file: 'dist/gcode-preview.js',
format: 'umd', // deprecated. might not work at some point
name: 'GCodePreview', // the global which can be used in a browser
globals: {
three: 'THREE'
}
}
],
external: [...Object.keys(pkg.dependencies || {})],
plugins: [
nodeResolve(),
esbuild({
minify: isProd
})
]
}
];
if (isProd) {
console.log('Building type definitions');
config.push({
input: 'src/gcode-preview.ts',
output: { file: 'dist/gcode-preview.d.ts', format: 'es' },
plugins: [dts()]
});
}
export default config;