Skip to content

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

@atti187

Description

@atti187

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions