-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathesbuild.js
More file actions
27 lines (22 loc) · 762 Bytes
/
esbuild.js
File metadata and controls
27 lines (22 loc) · 762 Bytes
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
const pkg = require("./package.json")
const { build } = require("esbuild")
const buildOptions = [
{ format: "esm", outfile: "dist/tailwind-styled-components.esm.js" },
{ format: "cjs", outfile: "dist/tailwind-styled-components.cjs.js" }
]
const external = [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})]
const buildAll = async () => {
const bundleFiles = buildOptions.map(async ({ format, outfile }) =>
build({
entryPoints: ["./src/index.ts"],
format,
bundle: true,
minify: true,
sourcemap: true,
outfile,
external // exclude dependencies from bundle
})
)
await Promise.all(bundleFiles)
}
buildAll()