From 0caaf603412e1939488f724da74fe1a027279006 Mon Sep 17 00:00:00 2001 From: Brandon Bayer Date: Mon, 14 Oct 2019 20:36:43 -0700 Subject: [PATCH] fix react-native-web example by adding babel plugin --- examples/with-react-native-web/next.config.js | 5 ++++- examples/with-react-native-web/package.json | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/with-react-native-web/next.config.js b/examples/with-react-native-web/next.config.js index 041ca4d5f86d0c..3a3e6c61093c7b 100644 --- a/examples/with-react-native-web/next.config.js +++ b/examples/with-react-native-web/next.config.js @@ -1,10 +1,13 @@ module.exports = { - webpack: config => { + webpack: (config, { defaultLoaders }) => { config.resolve.alias = { ...(config.resolve.alias || {}), // Transform all direct `react-native` imports to `react-native-web` 'react-native$': 'react-native-web' } + defaultLoaders.babel.options.plugins = [ + ['react-native-web', { commonjs: true }] + ] return config } } diff --git a/examples/with-react-native-web/package.json b/examples/with-react-native-web/package.json index b4731af96dca41..9a3497e1e70dbb 100644 --- a/examples/with-react-native-web/package.json +++ b/examples/with-react-native-web/package.json @@ -10,5 +10,8 @@ "react": "^16.7.0", "react-dom": "^16.7.0", "react-native-web": "^0.11.6" + }, + "devDependencies": { + "babel-plugin-react-native-web": "^0.11.7" } }