-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.js
45 lines (38 loc) · 880 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
45
const esbuild = require("esbuild")
const handleError = (e) => {
console.error(e)
process.exit(1)
}
// Client-side (browser) targeted files
esbuild
.build({
bundle: true,
minify: false,
entryPoints: ["src/index.jsx"],
outdir: ".",
external: [
"@emotion/react",
"@sanity/image-url",
"gatsby",
"prop-types",
"react",
],
// JSX factory is used to support Emotion `css` prop
jsxFactory: "jsx",
// Emotion does not provide a Fragment pragma; use named import
jsxFragment: "Fragment",
// Target reasonably current browsers
target: ["es2018"],
format: "esm",
})
.catch(handleError)
// Server-side build (node) targeted files
esbuild
.build({
bundle: false,
minify: false,
entryPoints: ["src/gatsby-node.js"],
outdir: ".",
platform: "node",
})
.catch(handleError)