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

[change] Update react-native-web example (#5489)

Utilize ES modules, which are now the default export for
`react-native-web`.

_NOTE:_ [This example requires `next@^7.0.0`](https://bit.ly/2PaEhao).
This commit is contained in:
David Calhoun 2018-10-22 15:32:24 -05:00 committed by Tim Neutkens
parent e02c0d000a
commit ba5f1b2c21
4 changed files with 18 additions and 12 deletions

View file

@ -1,6 +0,0 @@
{
"presets": ["next/babel"],
"plugins": [
["react-native-web", { commonjs: true }]
]
}

View file

@ -0,0 +1,13 @@
const withTM = require('next-plugin-transpile-modules')
module.exports = withTM({
transpileModules: ['react-native-web'],
webpack: (config) => {
// Alias all `react-native` imports to `react-native-web`
config.resolve.alias = {
'react-native$': 'react-native-web'
}
return config
}
})

View file

@ -6,11 +6,11 @@
"start": "next start"
},
"dependencies": {
"babel-plugin-react-native-web": "^0.8.8",
"next": "latest",
"react": "^16.4.1",
"react-art": "^16.4.1",
"react-dom": "^16.4.1",
"react-native-web": "0.9.3"
"next-plugin-transpile-modules": "^0.1.3",
"react": "^16.5.2",
"react-art": "^16.5.2",
"react-dom": "^16.5.2",
"react-native-web": "^0.9.3"
}
}

View file

@ -27,7 +27,6 @@ export default class MyDocument extends Document {
return (
<html style={{ height: '100%' }}>
<Head>
<title>react-native-web</title>
<meta name='viewport' content='width=device-width, initial-scale=1' />
</Head>
<body style={{ height: '100%', overflow: 'hidden' }}>