diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js index 7224589238f..949e9465fcd 100644 --- a/config/webpack.config.dev.js +++ b/config/webpack.config.dev.js @@ -30,6 +30,17 @@ module.exports = { }, resolve: { extensions: ['', '.js', '.json'], + alias: { + // This `alias` section can be safely removed after ejection. + // We do this because `babel-runtime` may be inside `react-scripts`, + // so when `babel-plugin-transform-runtime` imports it, it will not be + // available to the app directly. This is a temporary solution that lets + // us ship support for generators. However it is far from ideal, and + // if we don't have a good solution, we should just make `babel-runtime` + // a dependency in generated projects. + // See https://github.com/facebookincubator/create-react-app/issues/255 + 'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator') + } }, resolveLoader: { root: paths.ownNodeModules, diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js index 7ce51f2e29d..e085c274649 100644 --- a/config/webpack.config.prod.js +++ b/config/webpack.config.prod.js @@ -37,6 +37,17 @@ module.exports = { }, resolve: { extensions: ['', '.js', '.json'], + alias: { + // This `alias` section can be safely removed after ejection. + // We do this because `babel-runtime` may be inside `react-scripts`, + // so when `babel-plugin-transform-runtime` imports it, it will not be + // available to the app directly. This is a temporary solution that lets + // us ship support for generators. However it is far from ideal, and + // if we don't have a good solution, we should just make `babel-runtime` + // a dependency in generated projects. + // See https://github.com/facebookincubator/create-react-app/issues/255 + 'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator') + } }, resolveLoader: { root: paths.ownNodeModules,