2021-11-18 13:09:18 +00:00
|
|
|
|
/* eslint-disable */
|
|
|
|
|
const esbuild = require('esbuild')
|
|
|
|
|
const pkg = require('../package.json')
|
|
|
|
|
|
2021-12-22 00:14:38 +00:00
|
|
|
|
const { log: jslog } = console
|
|
|
|
|
|
2021-11-18 13:09:18 +00:00
|
|
|
|
async function main() {
|
|
|
|
|
esbuild.build({
|
|
|
|
|
entryPoints: ['./src/index.ts'],
|
|
|
|
|
outdir: 'dist/esm',
|
|
|
|
|
minify: false,
|
|
|
|
|
bundle: true,
|
|
|
|
|
format: 'esm',
|
|
|
|
|
target: 'es6',
|
|
|
|
|
tsconfig: './tsconfig.build.json',
|
|
|
|
|
jsxFactory: 'React.createElement',
|
|
|
|
|
jsxFragment: 'React.Fragment',
|
|
|
|
|
external: Object.keys(pkg.dependencies).concat(Object.keys(pkg.peerDependencies)),
|
|
|
|
|
incremental: true,
|
|
|
|
|
sourcemap: true,
|
|
|
|
|
watch: {
|
|
|
|
|
onRebuild(error) {
|
|
|
|
|
if (error) {
|
2021-12-22 00:14:38 +00:00
|
|
|
|
jslog(`× ${pkg.name}: An error in prevented the rebuild.`)
|
2021-11-18 13:09:18 +00:00
|
|
|
|
return
|
|
|
|
|
}
|
2021-12-22 00:14:38 +00:00
|
|
|
|
jslog(`✔ ${pkg.name}: Rebuilt.`)
|
2021-11-18 13:09:18 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main()
|