-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
app dir setAssetPrefix not work #51223
Comments
Is anyone following up this issue? |
Does app router won`t support custom server to setAssetPrefix? |
Bringing up this issue. Same happens to me starting from v13.5, it was working perfectly fine on v13.4.7. |
I fix it by set dynamic = 'force-dynamic' // layout.tsx
export const dynamic = 'force-dynamic' the reason is use file cache by default, so always is next.config.js assetPrefix |
It just work on v13.4.x
It just work on 13.4.1(my version), 13.5.x not work |
Would a workaround be conditionally setting const assetPrefix = process.env.NODE_ENV === 'production' ? https://mycdn.com : undefined;
/** @type {import('next').NextConfig} */
const nextConfig = {
assetPrefix,
...
};
module.exports = nextConfig; |
It doesn't work either unfortunately. |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64 Binaries: Node: 16.14.0 npm: 8.3.1 Yarn: 1.22.19 pnpm: 8.5.1 Relevant packages: next: 13.4.6-canary.0 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.0.4
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
Link to the code that reproduces this issue or a replay of the bug
https://codesandbox.io/p/sandbox/frosty-yalow-phg76g?file=%2Fnext.config.js%3A3%2C27
To Reproduce
custom server app dir setAssetPrefix not work in my local server. I don't know how to fix it
Describe the Bug
custom server app dir setAssetPrefix not work
Expected Behavior
all static asset should with custom prefix like: 'https://www.baidu.com/_next/static/chunk/xxx.js'
Which browser are you using? (if relevant)
Chrome 100.0.4878.0
How are you deploying your application? (if relevant)
custom server (http)
The text was updated successfully, but these errors were encountered: