From d6ae86a885c78f7c24a3faa1717acdd9e289d134 Mon Sep 17 00:00:00 2001 From: Max Thirouin Date: Sun, 1 Mar 2020 18:29:20 +0100 Subject: [PATCH 1/2] [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. --- 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..b50f6d4b945cb94 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 }, } From 1b7e78821c5c4919a20329604b7adc79c7657450 Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Sun, 1 Mar 2020 12:31:06 -0500 Subject: [PATCH 2/2] lint-fix --- examples/with-react-native-web/next.config.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/with-react-native-web/next.config.js b/examples/with-react-native-web/next.config.js index b50f6d4b945cb94..cb7efa483410d26 100644 --- a/examples/with-react-native-web/next.config.js +++ b/examples/with-react-native-web/next.config.js @@ -1,16 +1,16 @@ module.exports = { - webpack: (config) => { + 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 = [ - ".web.js", - ".web.ts", - ".web.tsx", + '.web.js', + '.web.ts', + '.web.tsx', ...config.resolve.extensions, - ]; + ] return config }, }