diff --git a/packages/babel-preset-react-app/index.js b/packages/babel-preset-react-app/index.js index 6ec10b5a0cd..b7c751e7454 100644 --- a/packages/babel-preset-react-app/index.js +++ b/packages/babel-preset-react-app/index.js @@ -84,6 +84,9 @@ module.exports = function(api, opts) { // Experimental macros support. Will be documented after it's had some time // in the wild. require('babel-plugin-macros'), + // Allows correctly aliasing `react-native` to `react-native-web` + // Prevents bundling unused react-native(-web) modules in production + require('babel-plugin-react-native-web'), // Necessary to include regardless of the environment because // in practice some other transforms (such as object-rest-spread) // don't work without it: https://github.com/babel/babel/issues/7215 diff --git a/packages/babel-preset-react-app/package.json b/packages/babel-preset-react-app/package.json index 5e3f3b0a5ff..bf3a8ed15c5 100644 --- a/packages/babel-preset-react-app/package.json +++ b/packages/babel-preset-react-app/package.json @@ -26,6 +26,7 @@ "@babel/preset-flow": "7.0.0-beta.38", "@babel/preset-react": "7.0.0-beta.38", "babel-plugin-macros": "2.0.0", + "babel-plugin-react-native-web": "0.5.2", "babel-plugin-transform-dynamic-import": "2.0.0", "babel-plugin-transform-react-remove-prop-types": "0.4.12" } diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index d631fc32a3b..06d23756023 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -413,7 +413,7 @@ module.exports = { // having to parse `index.html`. new ManifestPlugin({ fileName: 'asset-manifest.json', - publicPath: publicPath + publicPath: publicPath, }), // Generate a service worker script that will precache, and keep up to date, // the HTML & assets that are part of the Webpack build. diff --git a/packages/react-scripts/scripts/utils/createJestConfig.js b/packages/react-scripts/scripts/utils/createJestConfig.js index 593d17090a7..91846962e8f 100644 --- a/packages/react-scripts/scripts/utils/createJestConfig.js +++ b/packages/react-scripts/scripts/utils/createJestConfig.js @@ -48,7 +48,6 @@ module.exports = (resolve, rootDir, srcRoots) => { '^.+\\.module\\.css$', ], moduleNameMapper: { - '^react-native$': 'react-native-web', '^.+\\.module\\.css$': 'identity-obj-proxy', }, moduleFileExtensions: [