Skip to content

Commit

Permalink
Update with-react-native-web example to use babel (#6170)
Browse files Browse the repository at this point in the history
Fixes #6138

Tested with both latest and 8.0.0-canary.17
  • Loading branch information
Cauldrath authored and timneutkens committed Jan 29, 2019
1 parent 8b24103 commit dbdd663
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
16 changes: 16 additions & 0 deletions examples/with-react-native-web/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"presets": [
"next/babel"
],
"plugins": [
[
"module-resolver",
{
"root": ["./"],
"alias": {
"^react-native$": "react-native-web"
}
}
]
]
}
8 changes: 3 additions & 5 deletions examples/with-react-native-web/next.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
const withTM = require('next-plugin-transpile-modules')

module.exports = withTM({
transpileModules: ['react-native-web'],
module.exports = {
webpack: config => {
// Alias all `react-native` imports to `react-native-web`
config.resolve.alias = {
...(config.resolve.alias || {}),
'react-native$': 'react-native-web'
}

return config
}
})
}
2 changes: 1 addition & 1 deletion examples/with-react-native-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"start": "next start"
},
"dependencies": {
"babel-plugin-module-resolver": "^3.1.2",
"next": "latest",
"next-plugin-transpile-modules": "^0.1.3",
"react": "^16.7.0",
"react-art": "^16.5.2",
"react-dom": "^16.7.0",
Expand Down

0 comments on commit dbdd663

Please sign in to comment.