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

Lazy loaded component CSS doesn't contain assetPrefix #75181

Open
GeorgeHulpoi opened this issue Jan 22, 2025 · 0 comments
Open

Lazy loaded component CSS doesn't contain assetPrefix #75181

GeorgeHulpoi opened this issue Jan 22, 2025 · 0 comments
Assignees
Labels
Lazy Loading Related to Next.js Lazy Loading (e.g., `next/dynamic` or `React.lazy`). linear: next Confirmed issue that is tracked by the Next.js team. Module Resolution Module resolution (CJS / ESM, module resolving).

Comments

@GeorgeHulpoi
Copy link

Link to the code that reproduces this issue

https://github.com/GeorgeHulpoi/lazy-loaded-component-asset-prefix

To Reproduce

  1. Verify in development mode the behavior.
  2. Build the project with NEXT_PUBLIC_ASSET_PREFIX (it will be ussed in next.config.ts / assetPrefix.
  3. Move the _next/static to the cdn / server / whatever (I used an S3 + CloudFront for this reproduction).
  4. Start the server in production (everything should work fine).
  5. Press on Load lazy.
  6. You will see that the JS has loaded with assetPrefix:

Image

Nonetheless, the CSS doesn't have the assetPrefix

Image

Current vs. Expected behavior

Within development environment, clicking on Load lazy will show the following:

Image

In production with the assetPrefix set, the CSS fails to load:

Image

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
  Available memory (MB): 14189
  Available CPU cores: 16
Binaries:
  Node: 20.9.0
  npm: 10.1.0
  Yarn: 1.22.21
  pnpm: 9.15.0
Relevant Packages:
  next: 15.1.5 // Latest available version is detected (15.1.5).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: N/A
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Module Resolution, Lazy Loading

Which stage(s) are affected? (Select all that apply)

next start (local)

Additional context

No response

@github-actions github-actions bot added Lazy Loading Related to Next.js Lazy Loading (e.g., `next/dynamic` or `React.lazy`). Module Resolution Module resolution (CJS / ESM, module resolving). labels Jan 22, 2025
@gaojude gaojude self-assigned this Jan 22, 2025
@gaojude gaojude added the linear: next Confirmed issue that is tracked by the Next.js team. label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Lazy Loading Related to Next.js Lazy Loading (e.g., `next/dynamic` or `React.lazy`). linear: next Confirmed issue that is tracked by the Next.js team. Module Resolution Module resolution (CJS / ESM, module resolving).
Projects
None yet
Development

No branches or pull requests

2 participants