Expo Web - Only import web sub-project?


I’ve been using react-scripts to run my web app for some time now. My web app runs fine on react-scripts, but I’ve been trying to run my web app on the new Expo web CLI for some time now, with no success.

My project structure is such that the web app and the native app are both part of the same “Project” (Same tsconfig, build, etc.), but the actual source files are entirely separate from each other. Both use a shared /util folder.

I’m getting errors about packages that are only imported and used by files in my native app folder. I spent the morning trying to remove all those packages just so I could see if it would work, but can’t get any further. I removed react-native-svg-charts, and updated react-native-progress as mentioned here to get them to work - https://github.com/oblador/react-native-progress/issues/158.

However, upon following the instructions for installing react-native-community/art, I get the following error:

Module not found: Can't resolve 'mergeInto' in '/Users/Varun/Documents/workspace/clyme/node_modules/@react-native-community/art/node_modules/react-native/Libraries/vendor/core'

I’m unsure if there is a way to configure the loader such that this will work? I tried reading around in https://github.com/expo/web-examples with no success.

If my hunch is correct, then react-scripts is simply not importing these packages at all, which sidesteps the problem, but Expo is. So, my question is, is it possible to avoid importing the files on the web if they are not used? I suppose my options are either exploring that route, or going through and fixing all these issues that I only use on my native app, but are now causing issues with Expo Web.

Any help is really appreciated! Thank you.

One more note, this is how I configured my Expo app to test:
"main": "index",


import React from 'react';
import ReactDom from 'react-dom';
import App from './src/src/web/App';

ReactDom.render(<App />, document.getElementById("root"));

Re-read this post and wonder if I gave too much information. What I’m looking for is a way to have my expo-web project not compile or include the views that are in my native app only, and not imported from any of my web app files.

I’m fairly sure this is what it’s going on, and is the reason that react-scripts is working but expo web isn’t. Apologies if I’m mistaken on something but I don’t have the greatest grasp of webpack configs and the module loaders.



This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.