GithubHelp home page GithubHelp logo

Comments (9)

mrmckeb avatar mrmckeb commented on June 26, 2024 3

I've found the issue here and will push it shortly.

from presets.

mrmckeb avatar mrmckeb commented on June 26, 2024 1

@n8sabes, this was caused by the CRA preset applying the wrong loader to files imported by Storybook.

The correction is here:
https://github.com/storybookjs/presets/pull/77/files#diff-80b3f28ef184f3c7a4ac83b1974c3dc6R147

from presets.

mrmckeb avatar mrmckeb commented on June 26, 2024 1

@ljharb you're right - but this was never meant to be transpiled. The loader was simply omitted from the original preset, the new preset was forked from that, and the bug was carried over.

This is the related code:
https://github.com/SeedJobs/react-scripts/blob/master/packages/react-scripts/config/webpack.config.js#L489

from presets.

shilman avatar shilman commented on June 26, 2024

What I did:

cra sb result
3.3.0 [email protected] O
3.3.0 [email protected] + [email protected] X
3.3.0 [email protected] (auto-installs preset-cra) X
3.3.0 [email protected] - [email protected] O
3.3.0 [email protected] + [email protected] X

In other words, the problem appears to be an incompatibility between @storybook/preset-create-react-app and something else in the ecosystem (latest version of CRA? some change in inspect-js (see also: inspect-js/is-map#3)?

Other comments suggest that babel-loader is being applied to node_modules (see inspect-js/is-map#3 (comment))

from presets.

pocka avatar pocka commented on June 26, 2024

It seems that this rule tries to transpile is-map and fails?

https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/config/webpack.config.js#L455

from presets.

shilman avatar shilman commented on June 26, 2024

Fixed in @storybook/[email protected]!! Please upgrade and try it out! Thanks @mrmckeb for the fix 🙌

from presets.

colingm avatar colingm commented on June 26, 2024

Upgrading takes care of it, thank you so much for the quick turn around everyone!

from presets.

n8sabes avatar n8sabes commented on June 26, 2024

@mrmckeb and @shilman -- What was the cause and solution of this issue? I am running into the same problem with another (more mature) CRA project. Downgrading deep-equal to 1.1.1 works around the problem but unsure of the true origin or "correct" fix. Any insight is appreciated.

Please see:
deep-equal issue #78

from presets.

ljharb avatar ljharb commented on June 26, 2024

Top-level return is perfectly valid inside node modules; transpiling code you didn't author is unsafe; if you're going to transpile node_modules, then you should be sure to use settings that work on valid node modules :-)

from presets.

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.