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

how to support random assetPrefix #3209

Closed
1 task
huyansheng3 opened this issue Oct 30, 2017 · 3 comments
Closed
1 task

how to support random assetPrefix #3209

huyansheng3 opened this issue Oct 30, 2017 · 3 comments

Comments

@huyansheng3
Copy link

the example is assetPrefix: isProd ? 'https://cdn.mydomain.com' : '',
but i need set servals cdn name ,for example ,
assetPrefix: _.random(['https://cdn01.mydomain.com', 'https://cdn02.mydomain.com'])

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Current Behavior

Steps to Reproduce (for bugs)

Context

Your Environment

Tech Version
next
node
OS
browser
etc
@sergiodxa
Copy link
Contributor

That should work, just load lodash inside the next.config.js and run that code, but that will just pick one of the CDN when building the app.

If you want to pick one dynamically you need to do it yourself in the code of your app. Maybe get the CDN url in the getInitialProps and cache it client side (maybe with sessionStorage) so it's going to be the same always for that user session.

@timneutkens
Copy link
Member

👍

@lock
Copy link

lock bot commented May 10, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 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