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.
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
@cssalias 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.
tsconfig
webpack patch file
Steps to reproduce
Create a web part and try to use
requireto "import" a CSS file.Expected behavior
CSS file should be loaded and applied to the page.