Skip to content

Commit

Permalink
Merge pull request #3 from gnchrv/switching-to-esbuild
Browse files Browse the repository at this point in the history
Switching to esbuild
  • Loading branch information
gnchrv authored Sep 5, 2022
2 parents c4ecd44 + c5b2978 commit 2a5d5c7
Show file tree
Hide file tree
Showing 6 changed files with 1,187 additions and 2,081 deletions.
38 changes: 38 additions & 0 deletions esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Basic options
const options = {

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

// Whether to bundle together, minify and add a source map
bundle: true,
minify: true,
sourcemap: true,

// A target environment (esbuild doesn’t support this option specified in tsconfig.json)
target: 'es6',

// Log level is specified in order to print basic information even when launched as an npm script from package.json
logLevel: 'info'
}

// Different types of builds
const builds = {

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

// The watching one. Contains additional flag asking esbuild to watch for changes
'watch': () => ({ ...options, watch: true })
}

/*
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
*/
require('esbuild')
.build(builds[process.argv[2]]())
.catch(e => {
console.error(e)
process.exit(1)
})
Loading

0 comments on commit 2a5d5c7

Please sign in to comment.