Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve babel-runtime relative to the config #535

Merged
merged 1 commit into from
Sep 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion config/babel.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

var path = require('path');

module.exports = {
// Don't try to find .babelrc because we want to force this configuration.
babelrc: false,
Expand All @@ -33,7 +35,10 @@ module.exports = {
[require.resolve('babel-plugin-transform-runtime'), {
helpers: false,
polyfill: false,
regenerator: true
regenerator: true,
// Resolve the Babel runtime relative to the config.
// You can safely remove this after ejecting:
moduleName: path.dirname(require.resolve('babel-runtime/package'))
}]
]
};
7 changes: 6 additions & 1 deletion config/babel.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

var path = require('path');

module.exports = {
// Don't try to find .babelrc because we want to force this configuration.
babelrc: false,
Expand All @@ -30,7 +32,10 @@ module.exports = {
[require.resolve('babel-plugin-transform-runtime'), {
helpers: false,
polyfill: false,
regenerator: true
regenerator: true,
// Resolve the Babel runtime relative to the config.
// You can safely remove this after ejecting:
moduleName: path.dirname(require.resolve('babel-runtime/package'))
}],
// Optimization: hoist JSX that never changes out of render()
require.resolve('babel-plugin-transform-react-constant-elements')
Expand Down
11 changes: 2 additions & 9 deletions config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,8 @@ module.exports = {
// These are the reasonable defaults supported by the Node ecosystem.
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'),
// Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
'react-native': 'react-native-web'
}
},
Expand Down
11 changes: 2 additions & 9 deletions config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,8 @@ module.exports = {
// These are the reasonable defaults supported by the Node ecosystem.
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'),
// Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
'react-native': 'react-native-web'
}
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"babel-plugin-transform-object-rest-spread": "6.8.0",
"babel-plugin-transform-react-constant-elements": "6.9.1",
"babel-plugin-transform-regenerator": "6.14.0",
"babel-plugin-transform-runtime": "6.12.0",
"babel-plugin-transform-runtime": "6.15.0",
"babel-preset-latest": "6.14.0",
"babel-preset-react": "6.11.1",
"babel-runtime": "6.11.6",
Expand Down