fix(templates): remove tilde SCSS imports and add Sass loadPaths for Windows#16295
Merged
Conversation
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
r1tsuu
approved these changes
Apr 16, 2026
milamer
pushed a commit
to milamer/payload
that referenced
this pull request
Apr 20, 2026
…Windows (payloadcms#16295) ## Summary - Removes deprecated tilde (`~`) prefix from `@import` statements in all template SCSS files (`website`, `with-vercel-website`, `ecommerce`). The tilde syntax relies on legacy Webpack resolution behavior and is not supported by Turbopack, which is the default bundler in Next.js 16. - Adds `sassOptions.loadPaths` pointing to `@payloadcms/ui/dist/scss/` in each template's `next.config.ts`. This is a workaround for a Turbopack bug on Windows where Sass fails to resolve sibling imports (e.g. `@import 'vars'`) due to missing `includePaths` and backslash path issues (vercel/next.js#86431). - Expands the `lint:scss` script glob to also cover `templates/**/*.scss`, so the existing `no-tilde-imports` stylelint rule (added in payloadcms#15028) catches template files going forward. Fixes payloadcms#16059 ## Disclaimer This bug only reproduces on Windows. We are a Mac-only team and have not been able to reproduce it locally, but the fix aligns with the confirmed community workaround and is consistent with the changes already applied to `packages/ui` in payloadcms#15028. If the next release still does not resolve the issue for Windows users, I am happy to quickly explore a follow-up PR. ## Test plan - [x] Verify `pnpm run lint:scss` passes (no tilde imports detected) - [ ] Windows users: run `npx create-payload-app@latest -t website` and confirm `npm run dev` no longer throws `Can't find stylesheet to import` - [x] Verify templates still compile correctly on macOS/Linux (no regressions from `loadPaths` addition) Co-authored-by: German Jablonski <GermanJablo@users.noreply.github.com>
Contributor
|
🚀 This is included in version v3.84.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
~) prefix from@importstatements in all template SCSS files (website,with-vercel-website,ecommerce). The tilde syntax relies on legacy Webpack resolution behavior and is not supported by Turbopack, which is the default bundler in Next.js 16.sassOptions.loadPathspointing to@payloadcms/ui/dist/scss/in each template'snext.config.ts. This is a workaround for a Turbopack bug on Windows where Sass fails to resolve sibling imports (e.g.@import 'vars') due to missingincludePathsand backslash path issues (NextJS 16 version of turbopack failing to resolve bootstrap imports on Windows vercel/next.js#86431).lint:scssscript glob to also covertemplates/**/*.scss, so the existingno-tilde-importsstylelint rule (added in fix(ui): invalid sass imports to support windows - add Stylelint to prevent regression #15028) catches template files going forward.Fixes #16059
Disclaimer
This bug only reproduces on Windows. We are a Mac-only team and have not been able to reproduce it locally, but the fix aligns with the confirmed community workaround and is consistent with the changes already applied to
packages/uiin #15028. If the next release still does not resolve the issue for Windows users, I am happy to quickly explore a follow-up PR.Test plan
pnpm run lint:scsspasses (no tilde imports detected)npx create-payload-app@latest -t websiteand confirmnpm run devno longer throwsCan't find stylesheet to importloadPathsaddition)