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

✘ [ERROR] panic: runtime error: invalid memory address or nil pointer dereference (while parsing "<stdin>") #2913

Closed
nettybun opened this issue Feb 13, 2023 · 0 comments

Comments

@nettybun
Copy link

nettybun commented Feb 13, 2023

Full reproduction from scratch:

❯ cd /tmp
❯ npm i esbuild fflate
added 3 packages, and audited 4 packages in 2s
found 0 vulnerabilities
❯ npm ls esbuild fflate
tmp@ /private/tmp
├── esbuild@0.17.8
└── fflate@0.7.4
❯ echo 'export { unzipSync } from "node_modules/fflate";' | esbuild --bundle --platform=neutral
✘ [ERROR] panic: runtime error: invalid memory address or nil pointer dereference (while parsing "<stdin>")

  debug.Stack (runtime/debug/stack.go:24)
  helpers.PrettyPrintedStack (internal/helpers/stack.go:9)
  bundler.parseFile.func1 (internal/bundler/bundler.go:189)
  panic (runtime/panic.go:884)
  resolver.resolverQuery.loadAsMainField (internal/resolver/resolver.go:1818)
  resolver.resolverQuery.loadAsFileOrDirectory (internal/resolver/resolver.go:1666)
  resolver.(*Resolver).ProbeResolvePackageAsRelative (internal/resolver/resolver.go:606)
  bundler.ResolveFailureErrorTextSuggestionNotes (internal/bundler/bundler.go:573)
  bundler.parseFile (internal/bundler/bundler.go:428)
  bundler.(*scanner).maybeParseFile (internal/bundler/bundler.go:1360)

1 error

This also happens in JS version:

const esbuild = require('esbuild');
esbuild.build({
    stdin: {
        contents: 'export { unzipSync } from "node_modules/fflate";',
    },
    bundle: true,
    platform: 'neutral',
});

Note this doesn't crash for from "fflate"; from "./node_modules/fflate"; or any even from "node_modules" and from "node_modules/doesntexist". It only crashes when there's a a node_module path that exists on disk and the platform=neutral.

Also there's nothing wrong with fflate - I don't mean to pick on that package it's just the one I happened to poke at right now.

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

1 participant