Skip to content

Commit

Permalink
fix react-native-web example by adding babel plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
flybayer committed Oct 15, 2019
1 parent 7ff5cc1 commit 0caaf60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/with-react-native-web/next.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
module.exports = {
webpack: config => {
webpack: (config, { defaultLoaders }) => {
config.resolve.alias = {
...(config.resolve.alias || {}),
// Transform all direct `react-native` imports to `react-native-web`
'react-native$': 'react-native-web'
}
defaultLoaders.babel.options.plugins = [
['react-native-web', { commonjs: true }]
]
return config
}
}
3 changes: 3 additions & 0 deletions examples/with-react-native-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-native-web": "^0.11.6"
},
"devDependencies": {
"babel-plugin-react-native-web": "^0.11.7"
}
}

0 comments on commit 0caaf60

Please sign in to comment.