Git Product home page Git Product logo

Comments (7)

GeoffreyBooth avatar GeoffreyBooth commented on May 24, 2024 1

The bug is with the ESM loader not properly detecting CJS exports (so I think it's kinda related to loaders...).

All bug reports go to the main Node repo; this repo is for feature discussion and design. And if the bug occurs when no hooks are registered, it's a core Node issue and not something related to this.

from loaders.

aduh95 avatar aduh95 commented on May 24, 2024

Well this seems indeed to be a duplicate of nodejs/node#50649, and is hardly related to loaders, right? If you use the loaders API, it might help for this specific issue – but of course it has some limitations and would need some work (PRs welcome).

Closing as duplicate

from loaders.

privatenumber avatar privatenumber commented on May 24, 2024

The bug is with the ESM loader not properly detecting CJS exports (so I think it's kinda related to loaders...).

Given the Loaders milestones mentions improving CJS exports discovery, I felt like it may be worth moving the issue here. Didn't mean to open a duplicate issue. Anyway, I trust your judgement in triaging this. Thanks.

from loaders.

guybedford avatar guybedford commented on May 24, 2024

Supporting interception of the exports analysis as part of the CJS hooking sounds to me like a sensible design. Such hooking should use the CJS source load hook to do the exports analysis against that CJS source, and this hooking could also permit modifying the CJS exports detection algorithm.

from loaders.

GeoffreyBooth avatar GeoffreyBooth commented on May 24, 2024

Maybe the load hook could have an additional return property? So like in addition to source, for format: 'commonjs' it could also return the list of named exports (or whatever data cjs-module-lexer returns).

from loaders.

aduh95 avatar aduh95 commented on May 24, 2024

Supporting interception of the exports analysis as part of the CJS hooking sounds to me like a sensible design. Such hooking should use the CJS source load hook to do the exports analysis against that CJS source

That’s already what’s happening

from loaders.

privatenumber avatar privatenumber commented on May 24, 2024

FYI I confirmed CJS exports analysis is correctly detecting from the load result with the Hooks API (now that it supports loading CJS): nodejs/node#50649 (comment)

It would still nice to see this bug resolved in the ESM loader though. Open issue: nodejs/node#50649

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.