2021-08-10 16:12:55 +00:00
|
|
|
|
/* eslint-disable */
|
|
|
|
|
const esbuild = require('esbuild')
|
|
|
|
|
|
|
|
|
|
const name = process.env.npm_package_name || ''
|
|
|
|
|
|
|
|
|
|
async function main() {
|
|
|
|
|
esbuild.build({
|
|
|
|
|
entryPoints: ['./src/index.ts'],
|
|
|
|
|
outdir: 'dist/cjs',
|
|
|
|
|
minify: false,
|
|
|
|
|
bundle: true,
|
|
|
|
|
format: 'cjs',
|
2021-08-29 13:46:58 +00:00
|
|
|
|
target: 'es6',
|
2021-08-10 16:12:55 +00:00
|
|
|
|
jsxFactory: 'React.createElement',
|
|
|
|
|
jsxFragment: 'React.Fragment',
|
|
|
|
|
tsconfig: './tsconfig.json',
|
|
|
|
|
external: ['react', 'react-dom'],
|
2021-08-30 18:10:30 +00:00
|
|
|
|
incremental: true,
|
2021-08-10 16:12:55 +00:00
|
|
|
|
watch: {
|
|
|
|
|
onRebuild(error) {
|
|
|
|
|
if (error) {
|
|
|
|
|
console.log(`× ${name}: An error in prevented the rebuild.`)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
console.log(`✔ ${name}: Rebuilt.`)
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main()
|