Skip to content

Commit 2401fe0

Browse files
committed
Add a temporary fix for generators
This enables us to ship them now, and find a way to resolve runtime path without webpack later. See #255
1 parent 3732572 commit 2401fe0

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

config/webpack.config.dev.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ module.exports = {
3030
},
3131
resolve: {
3232
extensions: ['', '.js', '.json'],
33+
alias: {
34+
// This `alias` section can be safely removed after ejection.
35+
// We do this because `babel-runtime` may be inside `react-scripts`,
36+
// so when `babel-plugin-transform-runtime` imports it, it will not be
37+
// available to the app directly. This is a temporary solution that lets
38+
// us ship support for generators. However it is far from ideal, and
39+
// if we don't have a good solution, we should just make `babel-runtime`
40+
// a dependency in generated projects.
41+
// See https://github.com/facebookincubator/create-react-app/issues/255
42+
'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator')
43+
}
3344
},
3445
resolveLoader: {
3546
root: paths.ownNodeModules,

config/webpack.config.prod.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ module.exports = {
3737
},
3838
resolve: {
3939
extensions: ['', '.js', '.json'],
40+
alias: {
41+
// This `alias` section can be safely removed after ejection.
42+
// We do this because `babel-runtime` may be inside `react-scripts`,
43+
// so when `babel-plugin-transform-runtime` imports it, it will not be
44+
// available to the app directly. This is a temporary solution that lets
45+
// us ship support for generators. However it is far from ideal, and
46+
// if we don't have a good solution, we should just make `babel-runtime`
47+
// a dependency in generated projects.
48+
// See https://github.com/facebookincubator/create-react-app/issues/255
49+
'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator')
50+
}
4051
},
4152
resolveLoader: {
4253
root: paths.ownNodeModules,

0 commit comments

Comments
 (0)