Skip to content

Commit

Permalink
fix FOUT
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed May 6, 2024
1 parent 76e49c4 commit 521e41b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
21 changes: 12 additions & 9 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ import { App } from "./container/App";
import { Provider } from "./Context";

const cssFiles = import.meta.glob("./**/*.css");
for (const path in cssFiles) {
cssFiles[path]();
}
const promises: Promise<void>[] = Object.entries(cssFiles).map(([path, loader]) => {
return loader();
});

// Register icons and pull the fonts from the default SharePoint cdn:

initializeIcons();

ReactDOM.render(
<Provider>
<App />
</Provider>,
document.getElementById("root") as HTMLElement
);
Promise.all(promises).then(() => {
ReactDOM.render(
<Provider>
<App />
</Provider>,
document.getElementById("root") as HTMLElement
);
});
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"compilerOptions": {
"outDir": "build/dist",
"module": "esnext",
"target": "es2015",
"target": "ES2022",
"lib": [
"esnext",
"dom"
],
"sourceMap": true,
"allowJs": true,
"jsx": "preserve",
"moduleResolution": "node",
"moduleResolution": "NodeNext",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
Expand Down

0 comments on commit 521e41b

Please sign in to comment.