slorber / gatsby-plugin-react-native-web

react-native-web plugin for Gatsby

Home Page:https://sebastienlorber.com/using-expo-in-gatsby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't use without Expo...

lgxm3z opened this issue · comments

Quick Solution:

Use custom webpack config
https://www.gatsbyjs.com/docs/how-to/custom-configuration/add-custom-webpack-config/

Install

  • react-native-web
  • @types/react-native (If using TypeScript)

Create gatsby-node.js 📝

exports.onCreateWebpackConfig = ({stage, rules, loaders, plugins, actions}) => {
  actions.setWebpackConfig({
    resolve: {
      alias: {
        'react-native$': 'react-native-web'
      },
      extensions: ['.tsx', '.ts', '.jsx', '.js', '.web.tsx', '.web.ts', '.web.jsx', '.web.js']
    }
  });
};