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

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 wmonk committed Aug 7, 2017
1 parent 55df6e1 commit e8e2926
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 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 @@ -93,7 +93,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: ['.ts', '.tsx', '.js', '.json', '.jsx'],
// `web` extension prefixes have been added for better support
// for React Native Web.
extensions: ['.web.ts', '.ts', '.tsx', '.web.tsx', '.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 @@ -93,7 +93,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: ['.ts', '.tsx', '.js', '.json', '.jsx'],
// `web` extension prefixes have been added for better support
// for React Native Web.
extensions: ['.web.ts', '.ts', '.tsx', '.web.tsx', '.web.js', '.js', '.json', '.web.jsx', '.jsx'],
alias: {
// @remove-on-eject-begin
// Resolve Babel runtime relative to react-scripts.
Expand Down
4 changes: 2 additions & 2 deletions packages/react-scripts/scripts/utils/createJestConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = (resolve, rootDir) => {
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
setupFiles: [resolve('config/polyfills.js')],
setupTestFrameworkScriptFile: setupTestsFile,
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
moduleFileExtensions: ['web.ts', 'ts', 'web.tsx', 'tsx', 'js', 'jsx', 'json'],
testMatch: [
'<rootDir>/src/**/__tests__/**/*.ts?(x)',
'<rootDir>/src/**/?(*.)(spec|test).ts?(x)',
Expand All @@ -49,7 +49,7 @@ module.exports = (resolve, rootDir) => {
'ts-jest': {
tsConfigFile: paths.appTsTestConfig,
},
},
}
};
if (rootDir) {
config.rootDir = rootDir;
Expand Down

0 comments on commit e8e2926

Please sign in to comment.