-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from gnchrv/switching-to-esbuild
Switching to esbuild
- Loading branch information
Showing
6 changed files
with
1,187 additions
and
2,081 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) |
Oops, something went wrong.