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

CSS Bundle does not work when deployed to Vercel #6688

Closed
1 task done
dantman opened this issue Jun 26, 2023 · 4 comments
Closed
1 task done

CSS Bundle does not work when deployed to Vercel #6688

dantman opened this issue Jun 26, 2023 · 4 comments

Comments

@dantman
Copy link

dantman commented Jun 26, 2023

What version of Remix are you using?

1.17.1

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

I've included a git repo where I have done the following:
https://github.com/dantman/remix-vercel-css-bundled-modules-bug

  1. Run npx create-remix@latest
  2. Select Just the basics, Vercel, TypeScript
  3. Verify that root.tsx contains ...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []), (css-bundle is pre-configured in the default template)
  4. Add CSS using an import that depends on the css-bundle
  5. Verify your CSS works locally in npm run dev
  6. Deploy to Vercel
  7. Check that your CSS is working on the deployed Vercel site

Expected Behavior

Expected Vercel deployment to have same CSS as seen locally.

Actual Behavior

Bundled CSS and module CSS files that load when run in the dev server do not work when deployed to Vercel.
image

Local: Run npm run dev using https://github.com/dantman/remix-vercel-css-bundled-modules-bug
Vercel Deployment: https://remix-vercel-css-bundled-modules-bug-git-stock-dantman.vercel.app/

@dantman
Copy link
Author

dantman commented Jun 26, 2023

From what I can tell it seems like cssBundleHref is not defined when deployed to Vercel.

@markdalgleish
Copy link
Member

Looks like this is an issue on the Vercel side due to their Remix-specific build process. I'm currently reaching out to get it resolved. In the meantime I've verified that you should be able to fix this by rolling back to v1.17.0.

@BJvdA
Copy link

BJvdA commented Jun 29, 2023

For me it also breaks on v1.17.0, it seems like v1.18.0 fixes this issue

@markdalgleish
Copy link
Member

As noted above, this issue is currently fixed in the latest version.

Since this issue is caused by a version mismatch between @remix-run/css-bundle and Vercel's custom fork of @remix-run/dev which they only run in CI, I recently merged a PR that will go out in Remix v2 that decouples these two packages to avoid this issue re-emerging in the future: #6982.

@markdalgleish markdalgleish moved this from Backlog to Closed in v2 Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Closed
Development

No branches or pull requests

4 participants