Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[plugin-babel] Unexpected situation when using with babel-preset-react-app on Windows #1089

Closed
atti187 opened this issue Jan 13, 2022 · 2 comments · Fixed by #1090
Closed
Assignees

Comments

@atti187
Copy link
Contributor

atti187 commented Jan 13, 2022

  • Rollup Plugin Name: plugin-babel
  • Rollup Plugin Version: 5.3.0
  • Rollup Version: 2.63
  • Operating System (or Browser): Windows
  • Node Version: v14.15.5
  • Link to reproduction: https://regex101.com/r/y6BLj8/2

Expected Behavior

PreflightChecks are passed

Actual Behavior

Error: An unexpected situation arose. Please raise an issue at https://github.com/rollup/plugins/issues. Thanks!

Additional Information

https://github.com/facebook/create-react-app/blob/a422bf227cf5294a34d68696664e9568a152fd8f/packages/babel-preset-react-app/create.js#L194 is using

absoluteRuntimePath = path.dirname(
      require.resolve('@babel/runtime/package.json')
    );

which on Windows evaluates to <my-source-path>\\rollup-babel-bug\\node_modules\\@babel\\runtime. This breaks the preflightCheck at

if (inheritsHelperRe.test(check)) {
, as the regex is not considering backslashes.

const inheritsHelperRe = /\/helpers\/(esm\/)?inherits/;
should be changed to:

const inheritsHelperRe = /[\\\/]+helpers[\\\/]+(esm[\\\/]+)?inherits/;

If possible to verify on Windows I can provide a reproduction repo.

No matter what, I'll create a PR for the change.

@shellscape
Copy link
Collaborator

Thanks for opening an issue. Citing the issue template:

🚨 Issues WITHOUT a valid reproduction WILL BE CLOSED!

Please provide one by:

  1. Using the REPL.it plugin reproduction template at https://repl.it/@rollup/rollup-plugin-repro
  2. Provide a minimal repository link (Read https://git.io/fNzHA for instructions).
    Please use NPM for installing dependencies!
    These may take more time to triage than the other options.
  3. Using the Rollup REPL at https://rollupjs.org/repl/

⚠️ ZIP Files are unsafe and maintainers will NOT download them.

We cannot make this any clearer. Please add a reproduction and we'll be happy to triage further.

@atti187
Copy link
Contributor Author

atti187 commented Jan 13, 2022

Thought you might be ok with the regex reproduction link, as it's simple as that. But here's the repo I promised (if needed): https://github.com/atti187/rollup-babel-bug

@shellscape shellscape reopened this Jan 13, 2022
atti187 added a commit to atti187/plugins that referenced this issue Jan 13, 2022
shellscape pushed a commit that referenced this issue Feb 22, 2022
* fix(babel): consider path delimeter on windows (#1089)

* Fixed lint issues

* Added reference to issue in babel

* chore: update comment linking to the resolved Babel issue

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants