Comments (8)
Thanks for reporting. Per the policy on this project, the patterns supported were fully stabilized at the point this library started shipping, so that no new detections will be added. Otherwise that risks code that works in new Node.js versions mysteriously breaking in older versions and that would be very very difficult to debug.
I've posted a PR in #80 to better explain this as part of the project status.
from cjs-module-lexer.
/cc @lukastaegert
If Node.js will no longer update the detection mechanism, maybe Rollup will have to adapt to this case? I think it comes down to the use of for ... in
vs Object.keys(...).forEach(...)
.
from cjs-module-lexer.
Unfortunately that basically is the situation today - where build tools do have to accept these semantics as part of their targets now. It's ended up the lesser of the evils, and my apologies we couldn't do better!
from cjs-module-lexer.
esbuild ended up just using a hinting pattern itself - #46
from cjs-module-lexer.
I think the change was done to allow some level of improved ES3 compatibility via this option. But I see that this is only affecting a very minor group of users and since .forEach
can easily be polyfilled, I will revert it to the other pattern.
from cjs-module-lexer.
Actually, looking at this longer, it was not about ES3 compatibility. I wanted to switch to the other pattern altogether because it is smaller and more performant, but it cannot be used for live bindings because var k
is being reassigned. If you allow const
, then it will also use a for..in
loop with live-bindings: https://rollupjs.org/repl/?version=3.11.0&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQSUyMiUyMiUyQyUyMm1vZHVsZXMlMjIlM0ElNUIlN0IlMjJjb2RlJTIyJTNBJTIyZXhwb3J0JTIwKiUyMGZyb20lMjAnZm9vJyUyMiUyQyUyMmlzRW50cnklMjIlM0F0cnVlJTJDJTIybmFtZSUyMiUzQSUyMm1haW4uanMlMjIlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyb3V0cHV0JTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyY2pzJTIyJTJDJTIyZ2VuZXJhdGVkQ29kZSUyMiUzQSU3QiUyMmNvbnN0QmluZGluZ3MlMjIlM0F0cnVlJTdEJTdEJTdEJTdE
But yes, I will revert this change.
from cjs-module-lexer.
Fix at rollup/rollup#4826
from cjs-module-lexer.
Thanks @lukastaegert - I will close this one now.
from cjs-module-lexer.
Related Issues (20)
- Extending exports object detections HOT 20
- add tag for 1.2.2 HOT 4
- node ES6 import throws this error. HOT 18
- Error selecting connection connect ECONNREFUSED 127.0.0.1:5432
- Function call changes in TypeScript 4.4 seem to be breaking detection of named exports HOT 7
- Can't export when enumerable is "!0"
- When trying to build with snowpack this error is thrown HOT 4
- Not work well with TypeScript export default as output HOT 2
- exports can be detected in hashbang
- Feature Request: Also detect esbuild Re-exports HOT 1
- Bug: cannot detect exported numbers HOT 5
- Incompatibility with TypeScript (edge case) HOT 3
- Issue with parsing 'react-transition-group' HOT 2
- Out of bounds memory access HOT 1
- Real world edge case: prettier HOT 1
- Add RISC-V Support HOT 2
- Unable to detect exports from bundled webpack output HOT 6
- Cannot load externalized builtin: "internal/deps/cjs-module-lexer/lexer:/usr/lib/node_modules/cjs-module-lexer/lexer.js". HOT 9
- Allow externalized Wasm build HOT 1
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 cjs-module-lexer.