Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

images are not displayed when app is not installed in web root. #17

Closed
skang opened this issue Sep 28, 2023 · 3 comments
Closed

images are not displayed when app is not installed in web root. #17

skang opened this issue Sep 28, 2023 · 3 comments

Comments

@skang
Copy link

skang commented Sep 28, 2023

Steps to reproduce

step 1: modify "next.config.js" as below to install app to a different path:

....
module.exports = {
basePath: "/apps/materio",
...

step 2: run "npm run build"
step 3: run "npm run export"
step 4: publish app to web server (mine is powered by "nginx") by copying "out" folder to directory that maps to url path of "/apps/materio"

What is expected?

access materio app with URL: "https://localhost/apps/materio/index.html", it should work without problem. Specifically all components with images should display properly.

What is actually happening?

images in components of Materio app do not show up.

Additional data

@skang skang added the support label Sep 28, 2023
@neelbrahmakshatriya
Copy link
Member

Hi @skang,

This might be solved by adding the basePath in your images before making a production build.

For example, if you have written /images/my-image.png as your image source, you must update this path as /apps/materio/images/my-image.png. Another method is to set an environment variable in your .env file like BASE_PATH=/apps/materio and update image paths as:

`${process.env.BASE_PATH}/images/my-image.png`

We have not used the second method, but it probably should work.

You may refer to the official Next.js docs on the basePath.

Please let me if you have any further queries.

Copy link

github-actions bot commented Feb 9, 2024

This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Thank you for raising the concern.

@github-actions github-actions bot added the stale label Feb 9, 2024
Copy link

This issue has been automatically marked as closed because it has no recent activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants