-
Notifications
You must be signed in to change notification settings - Fork 28.4k
Could not use relative URLs with "next/font" #52050
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
Comments
+1. It seems Next doesn't have great support for being exported and served on a path that isn't the root, which is really frustrating. |
any update to resolve that? |
Turns out you can run a simple web server from your terminal
I know this doesn't fix the initial question, but this worked for me wanting to check the build locally. I can only confirm the above works on a mac. But getting a simple web server running from a command is an easy google. |
Any updates on this? I'm not sure why won't you allow to have |
Seems like we have to replace |
@TorryDo seems like this. Do we have any script to do this? I think someone mentioned |
Also running into this issue. I need to export a static build that uses a relative path, has there been any progress on allowing relative paths as the asset prefix? Thanks! |
@geekysam7 @csdiehl , I use this script to change |
Hi @TorryDo, Thanks for share it. But I have some problem here, o paste the .sh in my project but after buil o got this message "find: out: No such file or directory" I paste the .sh in main directory together with my package.json Should I need to do any more special thing? Thanks! |
@henriqpohl did you add |
@TorryDo I found the problem... You are using Linux and I'm using Mac OS, in that case the .sh command should be like code below:
Now, everything is working for me. Cheers! |
thank you @henriqpohl ! that worked for me on Mac OS. I also had to make a couple more changes in the post-processing script:
After that, it worked! hope this helps someone else trying to serve a Next.js static build from any root |
Are there any updates about fixing this build issue? |
@emilkrebs follow what @TorryDo share on Gist, I modified little bit and work perfect for me, I leaved here my modified also you can found and read in some comments above. |
If people were using |
For Next.js to have such an issue is really funny to me. I am working on implementing the above scripts but why should we need to do it? I saw someone close similar issue by saying:
What a joke!! I am trying to automate deploys of different sites within 1 S3 bucket as a means of building my pipeling to intake more customers. This is not a "very minimal gains" issue 🙄 |
The nextjs team is not going to solve this problem??? What’s amazing is that I already had this kind of problem after building without changing anything after installation. It’s such a high-star project. |
This comment has been minimized.
This comment has been minimized.
So will this be fixed? Why enforce http/https prefixes? I run into this weird problem while building an electron application and using static exports. I wish next.js would let go of the restrictions. |
This was super frustrating to me as well, and unfortunately I needed to do it in Windows which made things a lot more complicated. I put up a gist that takes @TorryDo 's idea and converts it to PowerShell commands for those of us forced to work in Windows. |
@TorryDo 's idea is working but my images is not loading and when I login the dashboard it show white blank. |
Unfortunately, I'm having the same problem with nextjs15. |
Seeing the same issue, hopping for a quick fix since aside from this Next15 has been great, |
Lol! It should be fixed asap 🤦♀️ OMG, these workarounds with a script. |
I am also facing the same issue,this needs to be fixed asap |
This comment has been minimized.
This comment has been minimized.
I had a similar issue with my portfolio website. The generated website code is stored in docs and the github pages publishing source option is set to docs. The following set of steps resolved my website rendering issue:
|
I can resolve this issue by changing all the assets' locations in the root file. |
Any updates? Disappointed to meet such problem... |
Replacing As above, RSC resource isn't properly loaded and it could not be fixed using something replacing The method I use is to directly cancel the limitation in node_modules and do that every time before |
Verify canary release
Provide environment information
Operating System: Platform: win32 Arch: x64 Version: Windows 11 Enterprise Binaries: Node: 20.3.1 npm: N/A Yarn: N/A pnpm: N/A Relevant Packages: next: 13.4.8-canary.13 eslint-config-next: 13.4.7 react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.6 Next.js Config: output: export
Which area(s) of Next.js are affected? (leave empty if unsure)
Font optimization (next/font)
Link to the code that reproduces this issue or a replay of the bug
npx create-next-app
To Reproduce
I want to export my pages using relative URL's like:
I am using the solution here: #2581
I am using the basic project created by create-next-app without Tailwind CSS.
(Every option in create-next-app is default except for Tailwind CSS )
Here is my next.config.js:
When I run "next build", an error occurs:
Describe the Bug
If I comment everything related to "next/font" in "app\layout.tsx"
Everything works fine.
So the bug is with next/font module.
Expected Behavior
"next/font" should support a relative path in assetPrefix like "./"
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: