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:
parent
e02c0d000a
commit
ba5f1b2c21
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"presets": ["next/babel"],
|
|
||||||
"plugins": [
|
|
||||||
["react-native-web", { commonjs: true }]
|
|
||||||
]
|
|
||||||
}
|
|
13
examples/with-react-native-web/next.config.js
Normal file
13
examples/with-react-native-web/next.config.js
Normal 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
|
||||||
|
}
|
||||||
|
})
|
|
@ -6,11 +6,11 @@
|
||||||
"start": "next start"
|
"start": "next start"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-plugin-react-native-web": "^0.8.8",
|
|
||||||
"next": "latest",
|
"next": "latest",
|
||||||
"react": "^16.4.1",
|
"next-plugin-transpile-modules": "^0.1.3",
|
||||||
"react-art": "^16.4.1",
|
"react": "^16.5.2",
|
||||||
"react-dom": "^16.4.1",
|
"react-art": "^16.5.2",
|
||||||
"react-native-web": "0.9.3"
|
"react-dom": "^16.5.2",
|
||||||
|
"react-native-web": "^0.9.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ export default class MyDocument extends Document {
|
||||||
return (
|
return (
|
||||||
<html style={{ height: '100%' }}>
|
<html style={{ height: '100%' }}>
|
||||||
<Head>
|
<Head>
|
||||||
<title>react-native-web</title>
|
|
||||||
<meta name='viewport' content='width=device-width, initial-scale=1' />
|
<meta name='viewport' content='width=device-width, initial-scale=1' />
|
||||||
</Head>
|
</Head>
|
||||||
<body style={{ height: '100%', overflow: 'hidden' }}>
|
<body style={{ height: '100%', overflow: 'hidden' }}>
|
||||||
|
|
Loading…
Reference in a new issue