1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Update with-react-native-web example to use babel (#6170)

Fixes https://github.com/zeit/next.js/issues/6138

Tested with both latest and 8.0.0-canary.17
This commit is contained in:
Benjamin Hanes 2019-01-29 07:42:44 -05:00 committed by Tim Neutkens
parent 8b24103d7f
commit dbdd663921
3 changed files with 20 additions and 6 deletions

View file

@ -0,0 +1,16 @@
{
"presets": [
"next/babel"
],
"plugins": [
[
"module-resolver",
{
"root": ["./"],
"alias": {
"^react-native$": "react-native-web"
}
}
]
]
}

View file

@ -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
}
})
}

View file

@ -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",