SharePoint / SharePoint/sp-dev-docs
[v1.23.2] CSS files no longer being imported
@Ashlesha-MSFT is already working on this.
Since Jul 3, 2026.
- Dominant language
- PowerShell
- Stars
- 1.4k
- Forks
- 1.1k
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 12
Description
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
💥 SharePoint Framework
Developer environment
Windows
What browser(s) / client(s) have you tested
All browsers
Describe the bug / error
I don't know if this is best practice but I "import" CSS files in the WebPart.ts file like this (see first line). These are common CSS files for fonts and styling things like h1, h2, etc. etc.
I upgraded to 1.23.2 and it no longer works. I have a @css alias set up in tsconfig.json and the webpack patch file. I'm not sure if that's related to the issue. I pasted that code below, as well. Is this a regression bug with all of the new CSS changes in the new release or is there a better way to do it? I tried changing require to import but that didn't work, either.
This code works fine in 1.23.0.
require('@css/common/workbench.css');
export default class FilingCalendarWebPart extends BaseClientSideWebPart<{}>
{
protected async onInit(): Promise<void>
{
.................
}
public render(): void
{
...............
}
}
tsconfig
"paths": {
"@css/*": [
"src/assets/css/*",
"temp/sass-ts/assets/css/*"
]
}
webpack patch file
const rootDir = path.resolve(__dirname, '..');
generatedConfiguration.resolve.alias['@css'] = path.resolve(rootDir, 'lib/assets/css/');
Steps to reproduce
Create a web part and try to use require to "import" a CSS file.
Expected behavior
CSS file should be loaded and applied to the page.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.