Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.6.13 breaks functionality #311

Closed
soadzoor opened this issue Aug 3, 2020 · 9 comments
Closed

0.6.13 breaks functionality #311

soadzoor opened this issue Aug 3, 2020 · 9 comments

Comments

@soadzoor
Copy link

soadzoor commented Aug 3, 2020

Hey,

In my case, 0.6.12 works flawlessly, but 0.6.13, and 0.6.14 has some weird errors. I'm using bundle, and sourcemaps, but no chunks. I'll use 0.6.12 until it's fixed, because it works just fine for my case.

Here's the error I'm getting:

panic: runtime error: index out of range [-1]

goroutine 2016 [running]:
github.com/evanw/esbuild/internal/printer.(*printer).addSourceMapping(0xc00185ac00, 0x0)
        /Users/evan/dev/esbuild/internal/printer/printer.go:475 +0x28e
github.com/evanw/esbuild/internal/printer.(*printer).printStmt(0xc00185ac00, 0x0, 0x87d580, 0xc005aefe00)
        /Users/evan/dev/esbuild/internal/printer/printer.go:2218 +0x55
github.com/evanw/esbuild/internal/printer.Print(0x10100010000, 0x0, 0x0, 0x0, 0x0, 0xc005a91c20, 0x1, 0x1, 0xc007368000, 0x295, ...)
        /Users/evan/dev/esbuild/internal/printer/printer.go:2887 +0x376
github.com/evanw/esbuild/internal/bundler.(*linkerContext).generateCodeForFileInChunk(0xc002af1860, 0xc005ae5e50, 0x1c00000012, 0xc004f0342d, 0x1, 0x1, 0xf00000000, 0x1c00000000, 0xc005d45120)
        /Users/evan/dev/esbuild/internal/bundler/linker.go:2773 +0x93f
created by github.com/evanw/esbuild/internal/bundler.(*linkerContext).generateChunk
        /Users/evan/dev/esbuild/internal/bundler/linker.go:2816 +0x4c2
(node:2704) UnhandledPromiseRejectionWarning: Error: The service was stopped
    at C:\wamp64\www\works\SRV4Frontend\node_modules\esbuild\lib\main.js:384:29
    at Socket.afterClose (C:\wamp64\www\works\SRV4Frontend\node_modules\esbuild\lib\main.js:331:7)
    at Socket.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1183:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
(node:2704) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2704) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@lolgesten
Copy link

I tried to upgrade and got the same. Here's my full invocation:

$ npx esbuild --color=true --bundle --loader:.svg=text --external:os --external:util --external:net --external:tls --target=es2018 --format=esm --sourcemap=inline ./src/index.ts
panic: runtime error: index out of range [-1]

goroutine 986 [running]:
github.com/evanw/esbuild/internal/printer.(*printer).addSourceMapping(0xc003fcd500, 0xc000000000)
	/Users/evan/dev/esbuild/internal/printer/printer.go:475 +0x287
github.com/evanw/esbuild/internal/printer.(*printer).printStmt(0xc003fcd500, 0x0, 0x148a060, 0xc003ff8500)
	/Users/evan/dev/esbuild/internal/printer/printer.go:2218 +0x4e
github.com/evanw/esbuild/internal/printer.Print(0x1000000, 0x0, 0x0, 0x0, 0x0, 0xc003ffa060, 0x1, 0x1, 0xc00384cc00, 0x18e, ...)
	/Users/evan/dev/esbuild/internal/printer/printer.go:2887 +0x36f
github.com/evanw/esbuild/internal/bundler.(*linkerContext).generateCodeForFileInChunk(0xc00090f2c0, 0xc003f4e400, 0x1c00000179, 0xc003e213a8, 0x1, 0x1, 0xf00000000, 0x1c00000000, 0xc004185358)
	/Users/evan/dev/esbuild/internal/bundler/linker.go:2773 +0x938
created by github.com/evanw/esbuild/internal/bundler.(*linkerContext).generateChunk
	/Users/evan/dev/esbuild/internal/bundler/linker.go:2816 +0x4bb

If I remove the sourcemap it works.

@lolgesten
Copy link

And just confirmed that 0.6.12 works fine.

@evanw
Copy link
Owner

evanw commented Aug 3, 2020

Thanks for the heads up. I'm unable to reproduce this. Any chance you are able to provide a code sample to reproduce the issue?

@soadzoor
Copy link
Author

soadzoor commented Aug 3, 2020

@evanw I can share my code privately with you if you provide an email address

@evanw
Copy link
Owner

evanw commented Aug 3, 2020

I can share my code privately with you if you provide an email address

Thanks!

@soadzoor
Copy link
Author

soadzoor commented Aug 3, 2020

@evanw Thanks! I've sent you an email, let me know if you've received it

@evanw
Copy link
Owner

evanw commented Aug 3, 2020

Thanks so much for the test case @soadzoor. Turns out it was caused by files that start with a blank Windows-style \r\n line. 😅

The problem should be fixed in version 0.6.15.

@soadzoor
Copy link
Author

soadzoor commented Aug 3, 2020

I can confirm it works in my case with 0.6.15. You're awesome!

@lolgesten
Copy link

Yep works for me too.

Now where do I have \r\n – very surprising 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants