From 847381a12ddd59b674d0785b36eabfa4a723d4a9 Mon Sep 17 00:00:00 2001 From: Tobias Bales Date: Fri, 9 Jun 2017 13:59:21 +0200 Subject: [PATCH] Support react-native-web by additionally resolving .web.{ts,tsx,js,jsx} files React native web adds the low level building blocks of react-native to web applications Combined with this change you can now use one codebase to build a react-native and web application sharing all/most/a lot of code since you can now `import MyComponent from './MyComponent' and have `MyComponent.ios.tsx` `MyComponent.android.tsx` and `MyComponent.web.tsx` --- packages/react-scripts/config/webpack.config.dev.js | 2 +- packages/react-scripts/config/webpack.config.prod.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index 2eed1e04e..0cf4ff46b 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -93,7 +93,7 @@ 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: ['.ts', '.tsx', '.js', '.json', '.jsx'], + extensions: ['.web.ts', '.web.tsx', '.web.js', '.web.jsx', '.ts', '.tsx', '.js', '.json', '.jsx'], alias: { // @remove-on-eject-begin // Resolve Babel runtime relative to react-scripts. diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index b710f480e..0c0a6910d 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -91,7 +91,7 @@ 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: ['.ts', '.tsx', '.js', '.json', '.jsx'], + extensions: ['.web.ts', '.web.tsx', '.web.js', '.web.jsx', '.ts', '.tsx', '.js', '.json', '.jsx'], alias: { // @remove-on-eject-begin // Resolve Babel runtime relative to react-scripts.