Skip to content

Commit

Permalink
Fix react-native-web example by adding babel plugin (#9078)
Browse files Browse the repository at this point in the history
* fix react-native-web example by adding babel plugin

* changes
  • Loading branch information
flybayer authored and timneutkens committed Oct 27, 2019
1 parent ab0a864 commit 1c11ffd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions examples/with-react-native-web/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
presets: ['next/babel'],
plugins: [['react-native-web', { commonjs: true }]]
}
3 changes: 2 additions & 1 deletion examples/with-react-native-web/next.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
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'
}
config.resolve.extensions.push('.web.js', '.web.ts', '.web.tsx')
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 1c11ffd

Please sign in to comment.