Giter VIP home page Giter VIP logo

Comments (3)

aduh95 avatar aduh95 commented on June 11, 2024

What version of Node.js are you using?

from loaders.

bpstrngr avatar bpstrngr commented on June 11, 2024

@aduh95 21.1 now when i'm encountering it again.
i'm returning {source,format,shortCircuit} entries from the registered "load" hook for many files, and at some point all i see is:


node:internal/event_target:1084
  process.nextTick(() => { throw err; });
                           ^
SyntaxError [Error]: Unexpected reserved word
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:155:18)
    at callTranslator (node:internal/modules/esm/loader:285:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:291:30)

Node.js v21.1.0

without context.

A few files get passed forward to the default nextLoad,
and i can't even exclude that one of those throws this,
but i assume in that case the stack trace would report the location of the import due to the call to nextLoad being present in it.
But since a lot of files are being transpiled like this,
i am struggling to come up with a way to re-parse them before the shortCircuit to be able to reproduce the syntax error.
Whatever follows internally after the shortCircuit return, it seems to me that it could catch the parse error from moduleProvider and report something from (or at) the earlier stack along with it.

from loaders.

bpstrngr avatar bpstrngr commented on June 11, 2024

actually inserting a re-parse/serialization in the load hook to get usable stack trace wasn't a big issue and it solved my problem, but the fact that i have to parse each file an additional time only because there's no way to trace or catch errors from shortCircuits is what seems wasteful.

from loaders.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.