Hi @Toriyama ,
Based on my research, you can follow these code to add external CSS Reference in SPFX Solution:
- import SPComponentLoader:
import { SPComponentLoader } from '@microsoft/sp-loader';
- Add the code in
onInit()
method :SPComponentLoader.loadCss('https://xxx/xxx.css');
- Confirm that the project is building by running
gulp serve
More information for reference:
https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/reference-third-party-css-styles#reference-third-party-css-stylesheets-from-url-in-the-web-part
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.