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 exportAssetPrefix config option #2145

Closed
wants to merge 1 commit into from

Conversation

brad-decker
Copy link

Github project pages for example, by default, have the root of the
page on a subdirectory. It is needed to be able to specify the static
asset prefix without changing the way next.js handles next dev/start

Github project pages for example, by default, have the root of the
page on a subdirectory. It is needed to be able to specify the static
asset prefix without changing the way next.js handles next dev/start
@@ -80,6 +80,11 @@ export default async function (dir, options) {
hotReloader: null
}

// Static hosted sites sometimes have different url requirements
if (config.exportAssetPrefix) {
renderOpts.assetPrefix = config.exportAssetPrefix.replace(/\/$/, '')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we simply use the existing assetPrefix option? https://github.com/zeit/next.js#cdn-support-with-asset-prefix

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the folder structure and asset path are different on the exported site versus local. Example: github pages project site where it's at organization.github.io/project-name but the files actually live in the root of that project repo. Using just assetPrefix breaks local development

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you're pointing out though with the production check in the config file. does the config function expose any context regarding whether static export is happening or would I need to run my command with NODE_ENV=production? Also I'm good with closing this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is related to deploying to a sub folder.
That's something we need to address separately.

@arunoda
Copy link
Contributor

arunoda commented Jun 9, 2017

Closing.
See more: #2145 (comment)

@arunoda arunoda closed this Jun 9, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jun 9, 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

Successfully merging this pull request may close these issues.

None yet

2 participants