Unverified Commit 644a1ef1 authored by Max Thirouin's avatar Max Thirouin Committed by GitHub

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: 's avatarJoe Haddad <timer150@gmail.com>
parent 8999ef26
module.exports = { module.exports = {
webpack: (config, { defaultLoaders }) => { webpack: config => {
config.resolve.alias = { config.resolve.alias = {
...(config.resolve.alias || {}), ...(config.resolve.alias || {}),
// Transform all direct `react-native` imports to `react-native-web` // Transform all direct `react-native` imports to `react-native-web`
'react-native$': '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 return config
}, },
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment