Skip to content

Commit

Permalink
Using build.js for maintenance
Browse files Browse the repository at this point in the history
Fixed to exluding externals explicitely

Note previously used node_modules/* based on documentation but
that rewrite to relative paths which do not follow node
module resolution rules. evanw/esbuild#1958
  • Loading branch information
matthiasg committed Jan 26, 2022
1 parent 9fce471 commit be6b6f8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
28 changes: 28 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { build } from 'esbuild'

const watch = process.argv.includes('-w') || process.argv.includes('--watch')

const options = {
entryPoints: ['./src/index.ts'],
outdir: './lib',
bundle: true,
format: 'esm',
platform: 'node',
target: ['es2020', 'node16'],
external: [
'yargs',
'rimraf',
'shelljs',
'tar',
],
watch: !watch ? undefined : {
onRebuild(error, result) {
if (error) console.error('watch build failed:', error)
else console.log('watch build succeeded:', result)
}
}
}

build(options).catch(() => process.exit(1))

// esbuild src/index.ts --platform=node --format=esm --target=es2020,node14 --external:./node_modules/* --bundle --outdir=lib
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
],
"type": "module",
"scripts": {
"build": "esbuild src/index.ts --platform=node --format=esm --target=es2020,node14 --external:./node_modules/* --bundle --outdir=lib",
"build:watch": "npm run build -- --watch",
"build": "node build.js",
"build:watch": "node build.js --watch",
"start": "node ./bin/aeppic-pack.js"
},
"repository": {
Expand Down

0 comments on commit be6b6f8

Please sign in to comment.