-
Notifications
You must be signed in to change notification settings - Fork 26.3k
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
Next.js uses <script> tag to load css files in static export #66221
Comments
Hi, Can you try to create a minimal reproduction repository? Remove as much as possible from the app, but keep the issue. A branch in your repo would be sufficient. There's quite a lot going on in your app, it is not gonna be trivial to figure out the root issue. |
@icyJoseph Thanks for looking into the issue. I just created a branch where most files have been removed but still kept a minimal UI page here: https://github.com/mlc-ai/web-llm-chat/tree/script_bug To reproduce the issue:
Then in the generated
Serving the website generates the error:
![]() |
Hi, Removing this from your next.config file: if (disableChunk) {
config.plugins.push(
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
);
} Fixes the issue, why did you implement this? What's the goal, can it be dropped? Does it need further tweaking from your side? Already calling this, not a Next.js issue, but let's see. |
Thank you! I confirmed the issue is resolved after removing this plugin. This repo is forked from another open source project so I'm not sure why the author added this in the first place. Before closing this issue, I wonder whether you have any idea on why this plugin caused this issue? Or is this something I should consult webpack for? |
No idea. You need to read the webpack documentation for that plugin. |
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. |
Link to the code that reproduces this issue
https://github.com/mlc-ai/web-llm-chat
To Reproduce
Open https://chat.webllm.ai/ , or clone the repo and generate static export using
npm run export
.Current vs. Expected behavior
Currently, in console you will see error
Uncaught SyntaxError: Unexpected token '.' (at 627a518ee201154a.css:1:1)
since the html incorrects loads css as JavaScript:Expected behavior: The css file should be loaded as stylesheet instead of as script.
Provide environment information
Which area(s) are affected? (Select all that apply)
Output (export/standalone)
Which stage(s) are affected? (Select all that apply)
next build (local), Other (Deployed)
Additional context
No response
The text was updated successfully, but these errors were encountered: