Skip to content

Commit

Permalink
Better React Native Web support (#2511)
Browse files Browse the repository at this point in the history
* Better React Native Web support

* Adding better react-native-web support for jest testing
  • Loading branch information
mini-eggs authored and gaearon committed Jun 28, 2017
1 parent 16e5d15 commit 6ab0ec0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/react-scripts/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ module.exports = {
// We also include JSX as a common component filename extension to support
// some tools, although we do not recommend using it, see:
// https://github.com/facebookincubator/create-react-app/issues/290
extensions: ['.js', '.json', '.jsx'],
// `web` extension prefixes have been added for better support
// for React Native Web.
extensions: ['.web.js', '.js', '.json', '.web.jsx', '.jsx'],
alias: {
// @remove-on-eject-begin
// Resolve Babel runtime relative to react-scripts.
Expand Down
4 changes: 3 additions & 1 deletion packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ module.exports = {
// We also include JSX as a common component filename extension to support
// some tools, although we do not recommend using it, see:
// https://github.com/facebookincubator/create-react-app/issues/290
extensions: ['.js', '.json', '.jsx'],
// `web` extension prefixes have been added for better support
// for React Native Web.
extensions: ['.web.js', '.js', '.json', '.web.jsx', '.jsx'],
alias: {
// @remove-on-eject-begin
// Resolve Babel runtime relative to react-scripts.
Expand Down
1 change: 1 addition & 0 deletions packages/react-scripts/scripts/utils/createJestConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module.exports = (resolve, rootDir, isEjecting) => {
moduleNameMapper: {
'^react-native$': 'react-native-web',
},
moduleFileExtensions: ['web.js', 'js', 'json', 'web.jsx', 'jsx'],
};
if (rootDir) {
config.rootDir = rootDir;
Expand Down

0 comments on commit 6ab0ec0

Please sign in to comment.