From 9f01293644922e4ab7e3640eb8376793a0643b8a Mon Sep 17 00:00:00 2001 From: Olivier SECRET Date: Fri, 27 Nov 2020 20:56:09 +0100 Subject: [PATCH] Add support for 'jsx' file extentions --- src/utils/compile.ts | 4 ++-- templates/expo-library/example/webpack.config.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/compile.ts b/src/utils/compile.ts index 7e0326087..f48134c42 100644 --- a/src/utils/compile.ts +++ b/src/utils/compile.ts @@ -40,11 +40,11 @@ export default async function compile({ files.map(async (filepath) => { const outputFilename = path .join(output, path.relative(source, filepath)) - .replace(/\.(js|tsx?)$/, '.js'); + .replace(/\.(jsx?|tsx?)$/, '.js'); await fs.mkdirp(path.dirname(outputFilename)); - if (!/\.(js|tsx?)$/.test(filepath)) { + if (!/\.(jsx?|tsx?)$/.test(filepath)) { // Copy files which aren't source code fs.copy(filepath, outputFilename); return; diff --git a/templates/expo-library/example/webpack.config.js b/templates/expo-library/example/webpack.config.js index 68375c60a..902a095b9 100644 --- a/templates/expo-library/example/webpack.config.js +++ b/templates/expo-library/example/webpack.config.js @@ -9,7 +9,7 @@ module.exports = async function (env, argv) { const config = await createExpoWebpackConfigAsync(env, argv); config.module.rules.push({ - test: /\.(js|ts|tsx)$/, + test: /\.(js|jsx|ts|tsx)$/, include: path.resolve(root, 'src'), use: 'babel-loader', });