You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use the Next.js basePath option (vercel/next.js#4998) with serverless-next.js but I'm having some problems.
Please let me know if I'm missing something but as far as I can see this is not supported yet.
I am happy to contribute a PR but would like to discuss the implementation first. My suggestion is to read the basePath setting from the next.config.js file during deployment and, when configured, use that for the following:
Change uploadAssetsToS3 to upload to <basePath>/ subdirectory in the bucket
Change the Cloudfront origins to <basePath>/_next/static/*, <basePath>/static/*, etc..
Anything else?
The text was updated successfully, but these errors were encountered:
@rrooding A couple of thoughts from me on the approach:
Rather than reading from the next.config.js file its easier to read from .next/routes-manifest.json which contains the basePath property.
I'm not sure you actually need to a new directory in the s3 bucket. As long as the CloudFront cache behaviour maps <basePath>/_next/static/* -> s3 _next/static/* should be OK I think. Only saying because it may be simpler to implement to start with at least.
FYI - I've raised an RFC for multi-zones like support here that is sort of related.
Feel free to start a PR and I'll help out with approach and testing.
I'm trying to use the Next.js basePath option (vercel/next.js#4998) with serverless-next.js but I'm having some problems.
Please let me know if I'm missing something but as far as I can see this is not supported yet.
I am happy to contribute a PR but would like to discuss the implementation first. My suggestion is to read the basePath setting from the next.config.js file during deployment and, when configured, use that for the following:
<basePath>/
subdirectory in the bucket<basePath>/_next/static/*
,<basePath>/static/*
, etc..Anything else?
The text was updated successfully, but these errors were encountered: