Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Commit e8e2926

Browse files
mini-eggswmonk
authored andcommitted
Better React Native Web support (#2511)
* Better React Native Web support * Adding better react-native-web support for jest testing
1 parent 55df6e1 commit e8e2926

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

packages/react-scripts/config/webpack.config.dev.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ module.exports = {
9393
// We also include JSX as a common component filename extension to support
9494
// some tools, although we do not recommend using it, see:
9595
// https://github.com/facebookincubator/create-react-app/issues/290
96-
extensions: ['.ts', '.tsx', '.js', '.json', '.jsx'],
96+
// `web` extension prefixes have been added for better support
97+
// for React Native Web.
98+
extensions: ['.web.ts', '.ts', '.tsx', '.web.tsx', '.web.js', '.js', '.json', '.web.jsx', '.jsx'],
9799
alias: {
98100
// @remove-on-eject-begin
99101
// Resolve Babel runtime relative to react-scripts.

packages/react-scripts/config/webpack.config.prod.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ module.exports = {
9393
// We also include JSX as a common component filename extension to support
9494
// some tools, although we do not recommend using it, see:
9595
// https://github.com/facebookincubator/create-react-app/issues/290
96-
extensions: ['.ts', '.tsx', '.js', '.json', '.jsx'],
96+
// `web` extension prefixes have been added for better support
97+
// for React Native Web.
98+
extensions: ['.web.ts', '.ts', '.tsx', '.web.tsx', '.web.js', '.js', '.json', '.web.jsx', '.jsx'],
9799
alias: {
98100
// @remove-on-eject-begin
99101
// Resolve Babel runtime relative to react-scripts.

packages/react-scripts/scripts/utils/createJestConfig.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = (resolve, rootDir) => {
2727
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
2828
setupFiles: [resolve('config/polyfills.js')],
2929
setupTestFrameworkScriptFile: setupTestsFile,
30-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
30+
moduleFileExtensions: ['web.ts', 'ts', 'web.tsx', 'tsx', 'js', 'jsx', 'json'],
3131
testMatch: [
3232
'<rootDir>/src/**/__tests__/**/*.ts?(x)',
3333
'<rootDir>/src/**/?(*.)(spec|test).ts?(x)',
@@ -49,7 +49,7 @@ module.exports = (resolve, rootDir) => {
4949
'ts-jest': {
5050
tsConfigFile: paths.appTsTestConfig,
5151
},
52-
},
52+
}
5353
};
5454
if (rootDir) {
5555
config.rootDir = rootDir;

0 commit comments

Comments
 (0)