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

Add config support to export project with custom path prefix #2335

Closed
moarwick opened this issue Jun 22, 2017 · 2 comments
Closed

Add config support to export project with custom path prefix #2335

moarwick opened this issue Jun 22, 2017 · 2 comments

Comments

@moarwick
Copy link

Currently, next export generates files assuming absolute paths. This is problematic when the static site is pushed to a sub-folder, e.g. Github Pages.

For example, if I push my my-project/out folder to a gh-pages branch, then access it at https://user.github.io/my-project/, the page is looking for assets at /_next/..., for example href="/_next/a3c4359f-2b55-4680-b981-dfddcf84cea4/page/index.js"

To solve the problem, I think we want to be able to specify a custom path e.g. /my-project, so then it would look for assets in /my-project/_next/...

@sergiodxa
Copy link
Contributor

You already can do that using assetPrefix configuration. Just add that key to your next.config.js and set /my-project if you are running on production, that way when running next build you will have /my-project/_next/... and in development you will use /_next/....

@arunoda
Copy link
Contributor

arunoda commented Jun 22, 2017

@moarwick deploying any Next.js app into a sub directory is kind a tricky. We'll address this after 3.0

@arunoda arunoda closed this as completed Jun 22, 2017
@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants