Giter Site home page Giter Site logo

Comments (7)

sgravrock avatar sgravrock commented on July 18, 2024 1

Done.

But I also think Jasmine can probably handle this transparently, by falling back to require() when it gets that particular error code. The drawback I see is that it'd lead to more confusing errors if someone tries to use ES module syntax in a JSX file without transpiling, but hopefully that's a rare scenario.

from jasmine-npm.

sgravrock avatar sgravrock commented on July 18, 2024

Well, it didn't take long at all to get the answer to "do we still need the jsLoader setting, and why?". One of the ways in which dynamic import isn't quite a drop-in replacement for require is that it only accepts paths that use a small predefined list of extensions, which doesn't include .jsx.

I'm not sure how best to reconcile the conflict between providing good support for ES modules and supporting nonstandard (but very common) file extensions. But as a quick fix you can get around the problem by adding jsLoader": "require" to your jasmine.json file.

from jasmine-npm.

EvHaus avatar EvHaus commented on July 18, 2024

@sgravrock Darn, that sucks. I can confirm that jsLoader: "require" fixes the problem.

Thanks for updating the docs in 1e133d6. Can I suggest updating the React documentation page here as well? Given that most React users will be following that guide I think the .jsx info will be relevant to them there.

from jasmine-npm.

EvHaus avatar EvHaus commented on July 18, 2024

Thanks! Going to close this issue as this addresses my initial issue.

from jasmine-npm.

ch1c0t avatar ch1c0t commented on July 18, 2024

Thanks to you both for handling this issue promptly. It resolved the same issue for .coffee files in coffeelib.

from jasmine-npm.

sgravrock avatar sgravrock commented on July 18, 2024

I've also just released 4.0.1, which handles this situation without the need for a configuration change.

from jasmine-npm.

EvHaus avatar EvHaus commented on July 18, 2024

Confirmed. With 4.0.1 jsx files work without jsLoader: "require". Thanks!

from jasmine-npm.

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.