chore(new-design): Include build step
This commit is contained in:
parent
de00e16f76
commit
93de1d698f
3 changed files with 31 additions and 17 deletions
|
@ -12,23 +12,34 @@ const banner = `/**
|
|||
|
||||
// Let esbuild generate the build
|
||||
let result
|
||||
(async () => {
|
||||
result = await esbuild.build({
|
||||
banner: { js: banner },
|
||||
bundle: true,
|
||||
entryPoints: ['index.mjs'],
|
||||
format: 'esm',
|
||||
outfile: 'dist/index.mjs',
|
||||
external: [],
|
||||
metafile: process.env.VERBOSE ? true : false,
|
||||
minify: process.env.NO_MINIFY ? false : true,
|
||||
sourcemap: true,
|
||||
platform: "node",
|
||||
}).catch(() => process.exit(1))
|
||||
;(async () => {
|
||||
result = await esbuild
|
||||
.build({
|
||||
banner: {
|
||||
js:
|
||||
banner +
|
||||
'\n' +
|
||||
`import { createRequire } from 'module';` +
|
||||
'\n' +
|
||||
`const require = createRequire(import.meta.url);`,
|
||||
},
|
||||
bundle: true,
|
||||
entryPoints: ['index.mjs'],
|
||||
format: 'esm',
|
||||
outfile: 'dist/index.mjs',
|
||||
external: ['fs'],
|
||||
metafile: process.env.VERBOSE ? true : false,
|
||||
minify: process.env.NO_MINIFY ? false : true,
|
||||
sourcemap: true,
|
||||
platform: 'node',
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
if (process.env.VERBOSE) {
|
||||
const info = await esbuild.analyzeMetafile(result.metafile)
|
||||
console.log(info)
|
||||
}
|
||||
})()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue