I'm using Expo with expo-router to build an app that I export as a static website using:
npx expo export --platform web --clear
I want to deploy the static site under a subpath, let's call it https://example.com/subpath.
However, after export, the generated HTML and JS bundles try to load assets from the root domain instead of the subpath:
❌ Tries to load:
https://example.com/_expo/static/js/...
https://example.com/assets/...
✅ But should load:
https://example.com/subpath/_expo/static/js/...
https://example.com/subpath/assets/...
Here is what I've tried :
- app.json :
expo.web.publicPath = '/subpath/' - web.config.json :
output.publicPath='/subpath/' - webpack.config.json :
const createExpoWebpackConfigAsync = require('@expo/webpack-config');
module.exports = async function (env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv);
config.output.publicPath = '/subpath/';
return config;
};
- I even tried adding a router.config.js with
module export = {basePath: '/subpath/',};
Nothing seems to be working, I've tried those solutions alone, combined, I don't get what I'm doing wrong. I can't find the right indications in the doc and obviously the last AI were not able to help neither.