-
Notifications
You must be signed in to change notification settings - Fork 2
/
esbuild.config.mjs
41 lines (37 loc) · 945 Bytes
/
esbuild.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
import esbuild from 'esbuild';
import fs from 'fs';
const entryPoint = './wypst.js';
const isDevelopment = process.env.NODE_ENV === 'development';
// Inline wasm build
esbuild.build({
entryPoints: [entryPoint],
bundle: true,
minify: !isDevelopment,
sourcemap: isDevelopment,
target: ['es6'],
outfile: './dist/wypst.min.js',
format: 'iife',
globalName: 'wypst',
loader: {
'.wasm': 'binary'
},
});
// Main build
esbuild.build({
entryPoints: [entryPoint],
bundle: true,
minify: false,
sourcemap: isDevelopment,
target: ['es6'],
outfile: './dist/wypst.js',
format: 'esm',
globalName: 'wypst',
loader: {
'.wasm': 'file'
},
metafile: true,
assetNames: 'wypst',
});
// Copy CSS files
fs.copyFileSync('./node_modules/katex/dist/katex.css', './dist/wypst.css');
fs.copyFileSync('./node_modules/katex/dist/katex.min.css', './dist/wypst.min.css');