forked from grapp-dev/stacks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathesbuild.config.js
32 lines (29 loc) · 925 Bytes
/
esbuild.config.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
const esbuild = require('esbuild')
const { jscodeshift } = require('./plugins/esbuild-jscodeshift')
const { replaceLiterals } = require('./plugins/replace-literals')
const { uncurryFunctions } = require('./plugins/uncurry-functions')
const { rewriteProps } = require('./plugins/rewrite-props')
const handleError = () => process.exit(1)
const build = (outfile, options) => {
return esbuild
.build({
entryPoints: ['src/Stacks.js'],
bundle: true,
format: 'cjs',
outfile: `dist/${outfile}`,
plugins: [
jscodeshift({
exclude: ['node_modules/**'],
plugins: [replaceLiterals, uncurryFunctions, rewriteProps],
}),
],
minify: false,
external: ['react', 'react-native'],
logLevel: 'info',
...options,
})
.catch(handleError)
}
build('index.js')
build('index.min.js', { minify: true })
build('index.mjs', { format: 'esm' })