Giter Club home page Giter Club logo

Comments (8)

guybedford avatar guybedford commented on July 24, 2024

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.

yyx990803 avatar yyx990803 commented on July 24, 2024

/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.

guybedford avatar guybedford commented on July 24, 2024

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.

guybedford avatar guybedford commented on July 24, 2024

esbuild ended up just using a hinting pattern itself - #46

from cjs-module-lexer.

lukastaegert avatar lukastaegert commented on July 24, 2024

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.

lukastaegert avatar lukastaegert commented on July 24, 2024

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.

lukastaegert avatar lukastaegert commented on July 24, 2024

Fix at rollup/rollup#4826

from cjs-module-lexer.

yyx990803 avatar yyx990803 commented on July 24, 2024

Thanks @lukastaegert - I will close this one now.

from cjs-module-lexer.

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.