Skip to content

Commit 57154f6

Browse files
authored
Resolve regenerator runtime relative to react-scripts (facebook#2175)
1 parent 51cb3c5 commit 57154f6

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

config/webpack.config.dev.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ module.exports = {
9393
// https://github.com/facebookincubator/create-react-app/issues/290
9494
extensions: ['.js', '.json', '.jsx'],
9595
alias: {
96+
// @remove-on-eject-begin
97+
// Resolve Babel runtime relative to react-scripts.
98+
// It usually still works on npm 3 without this but it would be
99+
// unfortunate to rely on, as react-scripts could be symlinked,
100+
// and thus babel-runtime might not be resolvable from the source.
101+
'babel-runtime': path.dirname(
102+
require.resolve('babel-runtime/package.json')
103+
),
104+
// @remove-on-eject-end
96105
// Support React Native Web
97106
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
98107
'react-native': 'react-native-web',

config/webpack.config.prod.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ module.exports = {
9090
// https://github.com/facebookincubator/create-react-app/issues/290
9191
extensions: ['.js', '.json', '.jsx'],
9292
alias: {
93+
// @remove-on-eject-begin
94+
// Resolve Babel runtime relative to react-scripts.
95+
// It usually still works on npm 3 without this but it would be
96+
// unfortunate to rely on, as react-scripts could be symlinked,
97+
// and thus babel-runtime might not be resolvable from the source.
98+
'babel-runtime': path.dirname(
99+
require.resolve('babel-runtime/package.json')
100+
),
101+
// @remove-on-eject-end
93102
// Support React Native Web
94103
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
95104
'react-native': 'react-native-web',

0 commit comments

Comments
 (0)