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" } }