Comments (3)
What version of Node.js are you using?
from loaders.
@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.
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)
- Official `fs` overlay HOT 3
- Node.js Loaders Team Meeting 2023-11-21
- bug: CJS exports analysis reads directly from disk HOT 7
- Node.js Loaders Team Meeting 2023-12-05 HOT 9
- Node.js Loaders Team Meeting 2023-12-19
- Bad coverage information when loaders are used
- Node.js Loaders Team Meeting 2024-01-02
- Node.js Loaders Team Meeting 2024-01-16 HOT 2
- improve registration HOT 2
- Node.js Loaders Team Meeting 2024-01-30 HOT 3
- --experimental-loader breaks in Node 18.19 HOT 5
- Node.js Loaders Team Meeting 2024-02-13 HOT 1
- Node.js Loaders Team Meeting 2024-02-27 HOT 2
- Node.js Loaders Team Meeting 2024-03-12 HOT 1
- Node.js Loaders Team Meeting 2024-03-26 HOT 1
- Node.js Loaders Team Meeting 2024-04-09 HOT 15
- Node.js Loaders Team Meeting 2024-04-13
- Node.js Loaders Team Meeting 2024-04-23 HOT 3
- Node.js Loaders Team Meeting 2024-05-07 HOT 3
- Node.js Loaders Team Meeting 2024-05-23 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loaders.