mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-27 08:13:46 +00:00
Add babel plugin to rewrite import paths
Replace 'react-native' imports with direct imports to the relevant module within 'react-native-web'. Follow up task is to also rewrite 'react-native-web' imports from the entry file to become direct imports (reduces bundle size). Close #608
This commit is contained in:
committed by
Nicolas Gallagher
parent
641c8c47e0
commit
7e8ef5b72c
@@ -34,6 +34,9 @@ const babelLoaderConfiguration = {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
cacheDirectory: true,
|
||||
// This aliases 'react-native' to 'react-native-web' and includes only
|
||||
// the modules needed by the app
|
||||
plugins: ['react-native-web/babel']
|
||||
// The 'react-native' preset is recommended (or use your own .babelrc)
|
||||
presets: ['react-native']
|
||||
}
|
||||
@@ -71,10 +74,6 @@ module.exports = {
|
||||
],
|
||||
|
||||
resolve: {
|
||||
// Maps the 'react-native' import to 'react-native-web'.
|
||||
alias: {
|
||||
'react-native': 'react-native-web'
|
||||
},
|
||||
// If you're working on a multi-platform React Native app, web-specific
|
||||
// module implementations should be written in files using the extension
|
||||
// `.web.js`.
|
||||
|
||||
Reference in New Issue
Block a user