From 644a1ef187dada46cf411141b27813c1cb0219e2 Mon Sep 17 00:00:00 2001 From: Max Thirouin Date: Sun, 1 Mar 2020 18:32:48 +0100 Subject: [PATCH] examples: react-native-web: fix config to prefer .web.* exts (#10774) * [examples/with-react-native-web] fix config to get .web.* extensions resolved before other Simple issue if you have `Compo.js` & `Compo.web.js` (eg 1st for iOS/android & second for web): with current config, .web are resolved after. My change change this situation so web extensions are resolved before the others. I removed the `defaultLoaders` since it was not used. Tell me if that was intentional so I can add it back. * lint-fix Co-authored-by: Joe Haddad --- examples/with-react-native-web/next.config.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/with-react-native-web/next.config.js b/examples/with-react-native-web/next.config.js index 70dc75a1b21969f..cb7efa483410d26 100644 --- a/examples/with-react-native-web/next.config.js +++ b/examples/with-react-native-web/next.config.js @@ -1,11 +1,16 @@ module.exports = { - webpack: (config, { defaultLoaders }) => { + webpack: config => { config.resolve.alias = { ...(config.resolve.alias || {}), // Transform all direct `react-native` imports to `react-native-web` 'react-native$': 'react-native-web', } - config.resolve.extensions.push('.web.js', '.web.ts', '.web.tsx') + config.resolve.extensions = [ + '.web.js', + '.web.ts', + '.web.tsx', + ...config.resolve.extensions, + ] return config }, }