Skip to content

Commit

Permalink
Merge pull request #4 from gnchrv/feature/update-esbuild
Browse files Browse the repository at this point in the history
Update esbuild and add type checking during the building phase
  • Loading branch information
gnchrv authored Jan 29, 2023
2 parents 2a5d5c7 + 40fcaf4 commit 8b3b62b
Show file tree
Hide file tree
Showing 4 changed files with 2,575 additions and 4,024 deletions.
19 changes: 10 additions & 9 deletions esbuild.js → esbuild.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import esbuild from 'esbuild'

// Basic options
const options = {

// Entry points and a path to a final bundle
// Entry points and the path to the final bundle
entryPoints: ['src/index.ts'],
outdir: 'dist',

Expand All @@ -18,20 +20,19 @@ const options = {
}

// Different types of builds
const builds = {
const configs = {

// The default one. Contains only the options listed above
'build': () => options,
// The default one. Builds right away
'build': () => esbuild.build(options),

// The watching one. Contains additional flag asking esbuild to watch for changes
'watch': () => ({ ...options, watch: true })
// The watching one. Set the context first and starts the watchg process later
'watch': () => esbuild.context(options).then(r => r.watch())
}

/*
Run the config. A command of type `node esbuild.js watch` should be used. The third element of the command will be used as a build name
Run the config. A command of the type `node esbuild.js watch` should be used. The third element of the command will be treated as a config name
*/
require('esbuild')
.build(builds[process.argv[2]]())
await configs[process.argv[2]]()
.catch(e => {
console.error(e)
process.exit(1)
Expand Down
Loading

0 comments on commit 8b3b62b

Please sign in to comment.