panic: runtime error: index out of range [7] with length 5 when building esm #3400
Closed
Description
I'm trying to build a typescript cli tool using esbuild 0.19.3 with esm
format using the following options:
const options: BuildOptions = {
entryPoints: ['bin/aumi-cli.ts'],
outdir: 'dist',
platform: 'node',
target: 'esnext',
format: 'esm',
bundle: true,
minify: production && !debug,
define: {
'process.env.DEV': debug ? '"true"' : '"false"',
'process.env.NODE_ENV': debug ? '"dev"' : '"production"',
},
};
type
is set as module
in package.json.
tsconfig options as follows:
{
"compilerOptions": {
"lib": ["es2021"],
"module": "ESNext",
"moduleResolution": "bundler",
"target": "es2019",
// React support
"jsx": "react",
"esModuleInterop": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": false,
"noImplicitAny": false,
"noEmit": true
},
"include": ["**/*.ts", "**/*.tsx"]
}
Receiving the following error from esbuild
panic: runtime error: index out of range [7] with length 5
goroutine 20 [running]:
github.com/evanw/esbuild/internal/bundler.(*scanner).validateTLA(0x14000063b00, 0x0?)
github.com/evanw/esbuild/internal/bundler/bundler.go:2522 +0x948
github.com/evanw/esbuild/internal/bundler.(*scanner).validateTLA(0x14000063b00, 0x0?)
github.com/evanw/esbuild/internal/bundler/bundler.go:2481 +0x118
github.com/evanw/esbuild/internal/bundler.(*scanner).validateTLA(0x14000063b00, 0x0?)
github.com/evanw/esbuild/internal/bundler/bundler.go:2481 +0x118
github.com/evanw/esbuild/internal/bundler.(*scanner).validateTLA(0x14000063b00, 0x0?)
github.com/evanw/esbuild/internal/bundler/bundler.go:2481 +0x118
github.com/evanw/esbuild/internal/bundler.(*scanner).validateTLA(0x14000063b00, 0x0?)
github.com/evanw/esbuild/internal/bundler/bundler.go:2481 +0x118
github.com/evanw/esbuild/internal/bundler.(*scanner).validateTLA(0x14000063b00, 0x0?)
github.com/evanw/esbuild/internal/bundler/bundler.go:2481 +0x118
github.com/evanw/esbuild/internal/bundler.(*scanner).validateTLA(0x14000063b00, 0x0?)
github.com/evanw/esbuild/internal/bundler/bundler.go:2481 +0x118
github.com/evanw/esbuild/internal/bundler.(*scanner).validateTLA(0x14000063b00, 0x0?)
github.com/evanw/esbuild/internal/bundler/bundler.go:2481 +0x118
github.com/evanw/esbuild/internal/bundler.(*scanner).validateTLA(0x14000063b00, 0x0?)
github.com/evanw/esbuild/internal/bundler/bundler.go:2481 +0x118
github.com/evanw/esbuild/internal/bundler.(*scanner).validateTLA(0x14000063b00, 0x0?)
github.com/evanw/esbuild/internal/bundler/bundler.go:2481 +0x118
github.com/evanw/esbuild/internal/bundler.(*scanner).validateTLA(0x14000063b00, 0x20d660?)
github.com/evanw/esbuild/internal/bundler/bundler.go:2481 +0x118
github.com/evanw/esbuild/internal/bundler.(*scanner).processScannedFiles(0x14000063b00, {0x1400001fef0, 0x1, 0x1400024c000?})
github.com/evanw/esbuild/internal/bundler/bundler.go:2462 +0xeb8
github.com/evanw/esbuild/internal/bundler.ScanBundle(_, {_, _, _, _, _, _}, {_, _}, _, ...)
github.com/evanw/esbuild/internal/bundler/bundler.go:1310 +0x90c
github.com/evanw/esbuild/pkg/api.rebuildImpl({0x140000780c0, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x1, 0x2, ...}, ...}, ...)
github.com/evanw/esbuild/pkg/api/api_impl.go:1511 +0x22c
github.com/evanw/esbuild/pkg/api.(*internalContext).rebuild(_)
github.com/evanw/esbuild/pkg/api/api_impl.go:1031 +0x2dc
github.com/evanw/esbuild/pkg/api.(*internalContext).Rebuild(...)
github.com/evanw/esbuild/pkg/api/api_impl.go:1092
github.com/evanw/esbuild/pkg/api.Build({0x2, 0x4, 0x0, 0x1400001e0f0, 0x0, {0x0, 0x0}, 0x0, 0x1, {0x0, ...}, ...})
github.com/evanw/esbuild/pkg/api/api.go:384 +0x74
main.(*serviceType).handleBuildRequest(0x140000a1f50, 0x0?, 0x1400013a000?)
github.com/evanw/esbuild/cmd/esbuild/service.go:763 +0xc90
main.(*serviceType).handleIncomingPacket.func2()
github.com/evanw/esbuild/cmd/esbuild/service.go:235 +0x5c
created by main.(*serviceType).handleIncomingPacket
github.com/evanw/esbuild/cmd/esbuild/service.go:233 +0x1b8
/Users/wilsoh58/Projects/sounds-offproduct/tools/aumi-cli/node_modules/.pnpm/esbuild@0.19.3/node_modules/esbuild/lib/main.js:2313
throw reject;
^
Error: The service was stopped
Metadata
Assignees
Labels
No labels