-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
44 lines (40 loc) · 951 Bytes
/
build.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
/* eslint-disable @typescript-eslint/no-var-requires */
// @ts-ignore
const { build } = require('esbuild');
const { sassPlugin } = require('esbuild-sass-plugin');
const { peerDependencies } = require('./package.json');
const entryFile = 'src/pulsable.tsx';
const shared = {
bundle: true,
entryPoints: [entryFile],
loader: { '.js': 'jsx' },
// Treat all dependencies in package.json as externals to keep bundle size to a minimum
external: Object.keys(peerDependencies),
logLevel: 'info',
minify: true,
sourcemap: false,
plugins: [sassPlugin()],
};
build({
...shared,
format: 'esm',
outfile: './dist/index.mjs',
target: ['esnext', 'node20.6.0'],
});
build({
...shared,
format: 'cjs',
outfile: './dist/index.js',
target: ['esnext', 'node20.6.0'],
});
build({
...shared,
plugins: [
sassPlugin({
cssImports: {},
}),
],
format: 'iife',
outfile: './dist/index.iife.js',
target: ['esnext'],
});