Coder Social home page Coder Social logo

Comments (7)

guybedford avatar guybedford commented on July 30, 2024 2

from cjs-module-lexer.

FredKSchott avatar FredKSchott commented on July 30, 2024 1

@guybedford are you looking for popular packages not working? Just ran into chai not working, which I know is a popular project. But they use some very strange export language that even a true parser would have trouble with: https://unpkg.com/[email protected]/lib/chai.js

from cjs-module-lexer.

guybedford avatar guybedford commented on July 30, 2024

Hi @FredKSchott, thanks for the feedback here.

Do you have an exact example of the sort of code pattern you'd like to see supported? Arbitrary expressions can't be supported as this is not a parser. But specific expression types might be possible.

More info on this in https://github.com/guybedford/cjs-module-lexer#exports-object-assignment.

from cjs-module-lexer.

FredKSchott avatar FredKSchott commented on July 30, 2024

Ah, maybe this is a regression then. In the docs you have:

// DETECTS EXPORTS: a, b, c
module.exports = {
  a,
  b: 'c',
  c: c
};

But when I run this with the lexer, I get:

{exports: ["a"], reexports: []}

That seems to contradict the comment in the code snippet.

from cjs-module-lexer.

guybedford avatar guybedford commented on July 30, 2024

Thanks, that was actually a readme typo - fixed in 4d56d33.

Would exactly supporting strings on the RHS specifically help in your use case? I didn't think this was such an important feature but they are a good example of a case that is easy to add as an extension. Again an example would help to understand what would be useful.

from cjs-module-lexer.

FredKSchott avatar FredKSchott commented on July 30, 2024

no real-world use-case on my end, this came out of a simple test file that I'd written to test that it was working correctly. If I see one, I'll definitely let you know.

We'll be moving forward with this in Snowpack as our default-on CJS handling, so hopefully our community surfaces some good feedback as well! Moving this from config opt-in to default-on is very exciting for us, especially for React developers who seem to run into this the most.

from cjs-module-lexer.

guybedford avatar guybedford commented on July 30, 2024

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.