forked from seasick/openscad-web-gui
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathesbuild.app.mjs
More file actions
54 lines (51 loc) · 1.4 KB
/
esbuild.app.mjs
File metadata and controls
54 lines (51 loc) · 1.4 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
48
49
50
51
52
53
54
/* eslint-env node */
import { copy } from 'esbuild-plugin-copy';
import { replace } from 'esbuild-plugin-replace';
let defaultCorsProxy = 'http://localhost:8888/';
export default (opt_options) => {
const corsProxy =
process.env.CORSPROXY || opt_options?.corsProxyUrl || defaultCorsProxy;
return {
entryPoints: ['src/index.tsx', 'src/index.html'],
bundle: true,
outdir: 'dist',
minify: process.env.NODE_ENV === 'production',
sourcemap: process.env.NODE_ENV !== 'production',
target: 'es2022',
logLevel: 'info',
loader: {
'.html': 'copy',
'.woff': 'file',
'.woff2': 'file',
'.3mf': 'copy',
},
plugins: [
copy({
resolveFrom: 'cwd',
assets: [
{
from: [
'./public/*.png',
'./public/*.ico',
'./public/*.webmanifest',
'./public/*.ttf',
],
to: ['./dist'],
},
{
from: ['./public/scad/**/*'],
to: ['./dist/scad'],
},
],
watch: true,
}),
replace({
__CORSPROXY: corsProxy,
__TRACKER_SNIPPET: process.env.TRACKER_SNIPPET || '',
__GITHUB_ISSUE_URL: process.env.GH_ISSUE_URL || '',
__GITHUB_REPO_URL: process.env.GH_REPO_URL || '',
__WEBSITE_URL: process.env.WEBSITE_URL || 'http://localhost:8000/',
}),
],
};
};