- chore: Type definitions enable code splitting.
- refactor: Test
.esbuild-dev/package.json
instead of its parent dir.
- refactor: Disable
--cache
by default, it might be too aggressive.
- feat: Add
--cwd
to change the working directory, it also affects the cache file logic.
- chore: Generate type definitions.
- feat: Add
--cache
and enable it by default. - refactor: Alias
temp
totmp
.
- fix: Path after
--import
should be an import specifier.
- feat: Shim
import.meta.{dirname,filename}
. - refactor: Use
"type": "module"
and change main file extension to.js
. - refactor: Use
--import
instead of--loader
when possible.
- feat: Add
temp
command to print the output directory. - feat: Add
--node
to append node options instead of relying onNODE_OPTIONS
env.
- feat: Add
--drop-labels
toEsbuildFlags
.
-
feat:
importFile()
andrequireFile()
can accept path with search params.
This is useful when you are running them on the same file but the file has changed since last import. For example you can make an esbuild svelte ssr plugin that even works in watch mode:onResolve({ filter: /index\.html$/ }, args => { return { path: args.path, namespace: "svelte-ssr" }; }); onLoad({ filter: /()/, namespace: "svelte-ssr" }, async args => { const svelteFile = findSvelteFile(args.path); const { default: App } = await importFile(svelteFile + "?t=" + Date.now(), { plugins: [svelte({ compilerOptions: { css: "none", generate: "ssr", hydratable: true } })], }); const { html, head } = App.render(); return { contents: renderHTML(args.path, { html, head }), loader: "copy" }; });
-
feat: Add
--line-limit
toEsbuildFlags
.
- fix: Wait for first build in watch mode.
- fix: Don't run output when there's error in build result.
- refactor: Await
context.watch()
. - fix: Keep shebang when prepending shims.
- refactor!: Integrate esbuild 0.17's
context
api.
- refactor: Lock
esbuild
to<=0.16
to avoid breaking changes.
- feat: Add
--packages
toEsbuildFlags
. - feat!: Use
--packages=external
if possible and no--include
is provided.
- feat: Add
--alias
toEsbuildFlags
.
- refatcor: Hack around
--shims
to make it work with--plugin
.
- refactor: Improve
--shims
(enabled by default) behavior.
Again, it has a caveat that--plugin
cannot be used with--shims
.
- feat: Add
--jsx-side-effects
toEsbuildFlags
.
- feat: Add
--include:name
to force include a package in the bundle.
- feat: Add
--jsx-import-source
and--jsx-dev
toEsbuildFlags
.
- fix: Add
shortCircuit
to loader api.
-
refactor: Correctly transform
--supported
to record of booleans. -
refactor!: Enable
--shims
by default. You can disable it by--shims=false
.
Caveats:--shims
cannot be used with--plugin
, because oneonLoad
callback can only be called once per file. -
refactor: Temporary built file paths now have replaced
/
to+
for better debug purpose.
- feat: Add
--supported
and--log-override
toEsbuildFlags
.
-
feat: Add
--shims
to polyfillimport.meta.url
and__dirname
,__filename
.
Below is the difference with/without this option:without
--shims
:$ cat test/index.ts // WARN: do not use these words as key console.log({ import_meta_url: import.meta.url } as any); console.log({ filename: __filename } as any); $ esbuild-dev test/index.ts { import_meta_url: 'file:///Users/hyrious/esbuild-dev/node_modules/.esbuild-dev/test/index.ts.js' } /Users/hyrious/esbuild-dev/test/index.ts:3 console.log({ filename: __filename } as any); ^ ReferenceError: __filename is not defined in ES module scope $ esbuild-dev --cjs test/index.ts { import_meta_url: undefined } { filename: '/Users/hyrious/esbuild-dev/node_modules/.esbuild-dev/test/index.ts.cjs' }
with
--shims
:$ esbuild-dev --shims test/index.ts { import_meta_url: 'file:///Users/hyrious/esbuild-dev/test/index.ts' } { filename: '/Users/hyrious/esbuild-dev/test/index.ts' } $ esbuild-dev --cjs --shims test/index.ts { import_meta_url: 'file:///Users/hyrious/esbuild-dev/test/index.ts' } { filename: '/Users/hyrious/esbuild-dev/test/index.ts' }
- feat: Forward child process exit code. (#19)
This feature was contributed by @tmueller.
- fix: Transform
mangle
related flags to RegExp.
This is still hand-written because there's no obvious way to generate it.
- feat: Add
mangle
related flags toEsbuildFlags
.
Now this list is generated.
- feat: Add
--drop:
toEsbuildFlags
. - feat: Add
rs
in watch mode to force rebuild and run.
- fix: (loader) Ignore url that are not file url in
load()
.
- feat: Add
--loader
to run file with--experimental-loader
.
Note that it does not support esbuild plugins.
- fix: Fix using plugin from local file.
- package: Peer dependency
esbuild
→*
.
-
dep: Move esbuild to peer dependencies.
If you can not use this package at global environment, trynpm i -g esbuild
. -
refactor: You can pass esbuild options through command line.
usage: esbuild-dev [esbuild options | esbuild-dev options] entry [...args] esbuild-dev --cjs --unknown-flag1 --jsx-factory=h main.ts --unknown-flag2 # same as `node main.js --unknown-flag1 --unknown-flag2`
Internally, it shares the same processing logic as esbuild's.
-
package: Target
node14.8
→node16.13
.
- dep: Upgrade esbuild to 0.14.x.
This is not a minor version upgrade. I guess there won't be any issue. Finally I will find a way to make esbuild a peer dependency, so that their versions can be decoupled.
- refactor: It will log warnings about not able to load plugins.
- dep: Upgrade esbuild to 0.13.x.
- fix: Missing args.d.ts in release.
- fix: Make it work in workspace by looking up 2 parent's package.json.
- types: Include args.d.ts in root path.
- fix: Fix a conversion bug in
buildOptionsToArgs()
. - refactor: Now errors throw-ed by esbuild will not be printed twice.
-
fix: All flags after the entry are passed to script.
Previously, all flags are processed despite the side of them. This leads to a bad behavior:esbuild-dev --cjs --unknown-flag main.ts --help # prints esbuild-dev's help instead of calling `node main.js --help` # same as `esbuild-dev --help`
Now it was fixed. Flags after the entry are always passed to script. Note that unknown flags are also passed to the script for loose rule.
esbuild-dev --cjs --unknown-flag main.ts --help # same as `node main.js --unknown-flag --help`
-
refactor:
argsToBuildOptions
andbuildOptionsToArgs
now accept & return bothBuildOptions
andTransformOptions
.
-
refactor: Split esm dist files, so that
args()
can be used without importing esbuild.
Note: you may have to add such shim.d.ts for correct types:declare module "@hyrious/esbuild-dev/args" { export { argsToBuildOptions, buildOptionsToArgs } from "@hyrious/esbuild-dev"; }
- feat: Add
--bare
option to cli commandexternal
.
This option makes the output in the format of "one name per line". - refactor:
--target=esnext
by default inexternal()
. - refactor: Use
{}
instead ofSet
inexternal()
.
This minor change makes the result keep order on some platforms, which may be useful.
- feat:
external()
to search external libraries. - cli: Sub command
external
to callexternal()
. - feat:
buildOptionsToArgs()
to reverseargsToBuildOptions()
.
- [BREAKING]: There's no
--build
any more. - Removed
chokidar
dependency, now it uses the builtin watch mode in esbuild.
This makes re-build/run slower, but will eat less CPU.
- feat: Support multiple build entries when use
--build
.
For example:esbuild-dev --build src/index.ts src/bin.ts --outdir=lib
. - feat: Support
--build
without entry file name.
In that case, it will infer your entries through package.json.
- fix:
importFile()
use correct path url. - fix: Camelize keys when parsing args from command line.
- fix: Support
pkg.module
. - feat:
requireFile()
to dynamically require a file, remember to add--cjs
to use it. - feat:
importFile()
to dynamically import a file.
- fix: Incorrect watch files on first run.
- fix:
lookupFile
typo error. - feat: Support
--cjs
forrequire.resolve
usage. - fix: Remove
--enable-source-maps
in its bin file to prevent GitHub Action error.
- [BREAKING]: The outfile format is changed to
esm
.__filename
replacement is preserved for compatibility.require()
will throw error, useimport
instead.
- Deps are discovered through esbuild metafile instead of scanning
import
by hand. - Export names are changed:
esbuildRun
→runFile
,esbuildDev
→watchFile
.
- Bundle entry point to
node_modules/.esbuild-dev/file.js
and run it. - Watch and rebuild incrementally and rerun.
- Shortcut to call
esbuild --bundle
. - Plugins support.