0.0.10 • Published 8 months ago

esbuild-debug-tools v0.0.10

Weekly downloads
-
License
-
Repository
-
Last release
8 months ago

esbuild-debug-tools is a tiny helper which makes debbugging with esbuild i little bit easier.

There two exports in this library.

WatchPlugin

Allows to listen for build start and build finish (and get build results). Accepts optional config:

export type WatchPluginOpts = {
  onStart?: () => void
  onEnd?: (result: BuildResult<BuildOptions>) => void
}

if no config is provided plugin will print results in standart console output.

startDebugServer

Runs simple debug server. Method accepts options object:

export type DebugServerOpts = {
  apiPathRewrite?: {
    original: string
    alias: string
  }
  debugPort: number
  htmlPagePath: string
  watchPluginOpts?: WatchPluginOpts
}

apiPathRewrite - definition for rewriting cross-domain call to relative path. Can be useful to avoid problems with cross domain requests. For example, in debug mode we can use "/api/get-some-data", and this call will be redirected to original domain "https://api.somedomain.com".

debugPort - port to run application on.

htmlPagePath - path to output html file. We need it to read it and write to response when proxying the request.

watchPluginOpts - debug server uses WatchPlugin to detech code chaged, so it's a way to define its options.

Good to know

  1. Library requires esbuild of version 0.17.10 or later.
  2. Currently esbuild-debug-tools doesn't have livereaload, so you have to provide own livereload plugin or reload page manually.
  3. Path rewrite also supports web sockets.
0.0.10

8 months ago

0.0.9

8 months ago

0.0.7

11 months ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago