Reputation: 166
I have a app created with expo and it contains Web and Native code and uses expo-webpack for generating the builds.
It has the below folder structure
->index.tsx
->screens
|
->native
|
->dashboard.tsx
-web
|
->dashboard.web.tsx
I'm using npx expo export:web
command to create the web build. I have platform specific code written throughout the project.
My index.tsx file contains logic something like this
if (Platform.OS === 'web')
return 'WebDashboard Component'
else
return 'NativeDashboard Component';
My issue here is when I run the build command npx expo export:web
I'm getting both WebDashboard code as well as NativeDashboard code in the final JS file post build, but I want only WebDashboard component to be present in the build file when I run the web build.
Expo version: 49
I want to reduce the final build file size by doing this as my current codebase is large.
Any suggestions would be helpful.
Upvotes: 2
Views: 214