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:
parent
8b24103d7f
commit
dbdd663921
16
examples/with-react-native-web/.babelrc
Normal file
16
examples/with-react-native-web/.babelrc
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
"next/babel"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
[
|
||||||
|
"module-resolver",
|
||||||
|
{
|
||||||
|
"root": ["./"],
|
||||||
|
"alias": {
|
||||||
|
"^react-native$": "react-native-web"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,13 +1,11 @@
|
||||||
const withTM = require('next-plugin-transpile-modules')
|
module.exports = {
|
||||||
|
|
||||||
module.exports = withTM({
|
|
||||||
transpileModules: ['react-native-web'],
|
|
||||||
webpack: config => {
|
webpack: config => {
|
||||||
// Alias all `react-native` imports to `react-native-web`
|
// Alias all `react-native` imports to `react-native-web`
|
||||||
config.resolve.alias = {
|
config.resolve.alias = {
|
||||||
|
...(config.resolve.alias || {}),
|
||||||
'react-native$': 'react-native-web'
|
'react-native$': 'react-native-web'
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
"start": "next start"
|
"start": "next start"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"babel-plugin-module-resolver": "^3.1.2",
|
||||||
"next": "latest",
|
"next": "latest",
|
||||||
"next-plugin-transpile-modules": "^0.1.3",
|
|
||||||
"react": "^16.7.0",
|
"react": "^16.7.0",
|
||||||
"react-art": "^16.5.2",
|
"react-art": "^16.5.2",
|
||||||
"react-dom": "^16.7.0",
|
"react-dom": "^16.7.0",
|
||||||
|
|
Loading…
Reference in a new issue