Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: styles not loading issue #461

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion example/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import { APP_INIT_ERROR, APP_READY, initialize } from '@edx/frontend-platform';
import { subscribe } from '@edx/frontend-platform/pubSub';
import { Routes, Route } from 'react-router-dom';

import './index.scss';
import ExamplePage from './ExamplePage';
import AuthenticatedPage from './AuthenticatedPage';

import('./index.scss');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dynamic import here makes the CSS get dynamically loaded at runtime, resulting in a Flash Of Unstyled Content (FOUC).

It also doesn't explain why import './index.scss'; doesn't work given that's how all MFEs and other example apps in our JS library repos import it without an issue, e.g. frontend-component-footer (source).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have looked into this issue and was not able to figure out why import './index.scss'; is not working. Webpack config and version all the things are exactly similar to the ones used in header/footer.

However while doing RnD on this issue, I found this comment in webpack.dev.config that "We don't care about FOUC in development". As this dynamic import is being used in the example app, in my opinion we can ignore this issue for now. What do you suggest?


subscribe(APP_READY, () => {
ReactDOM.render(
<AppProvider>
Expand Down