Skip to content

Remove runtime alias hack - #5142

Merged
Timer merged 8 commits into
react:masterfrom
Timer:fix-runtime
Sep 27, 2018
Merged

Remove runtime alias hack#5142
Timer merged 8 commits into
react:masterfrom
Timer:fix-runtime

Conversation

@Timer

Copy link
Copy Markdown
Contributor

Inspired by #5136, fixes#5116.

// project
// https://github.com/babel/babel/blob/090c364a90fe73d36a30707fc612ce037bdbbb24/packages/babel-plugin-transform-runtime/src/index.js#L35-L42
absoluteRuntime: path.dirname(
require.resolve('@babel/runtime/package.json')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can pass own path here btw I think. See usage in babel/babel#8435.

@gaearon

Copy link
Copy Markdown
Contributor

That's more or less what we used to do until I changed it in #2175. I was fixing #2172 (comment): it embedded my name in a library build. I think this would regress in the same way: any library using babel-preset-react-app would suddenly get hardcoded runtime path.

Maybe the solution is to make it an option, and then pass it through from webpack config.

@gaearongaearon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't break libraries

@gaearon

Copy link
Copy Markdown
Contributor

Ideally we should also try to create a relative path somehow. So that even in sourcemaps you'd see something like ../../../node_modules/@babel/runtime instead of your username etc.

@gaearongaearon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally with some e2e regression tests

@Timer
Timer merged commit 27ac52a into react:masterSep 27, 2018
@Timer
Timer deleted the fix-runtime branch September 27, 2018 20:53
@TimerTimer mentioned this pull request Sep 27, 2018
zmitry pushed a commit to zmitry/create-react-app that referenced this pull request Sep 30, 2018
* Remove runtime alias hack
* Pass absolute path to preset
* Change comment
* Give a relative path to absolute runtime
* Clean up config
* Tweak again
* Make absolute runtime the default
* Remove runtime package from error overlay
@locklockBot locked and limited conversation to collaborators Jan 19, 2019
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

project can not work after upgrade react-scripts form 2.0.0-next.a671462c to 2.0.0

3 participants

@Timer@gaearon@facebook-github-bot