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

Conversation

Syed-Ali-Abbas-Zaidi
Copy link
Contributor

@Syed-Ali-Abbas-Zaidi Syed-Ali-Abbas-Zaidi commented Mar 29, 2023

Ticket
example MFE application does not load styles from index.scss

Description:
This PR fixes the issue related to styles not being loaded.

Screenshots
Screenshot 2023-03-30 at 1 12 32 PM
Screenshot 2023-03-30 at 1 11 39 PM

@codecov
Copy link

codecov bot commented Mar 29, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (b47e2a7) 83.22% compared to head (285cb9e) 83.22%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #461   +/-   ##
=======================================
  Coverage   83.22%   83.22%           
=======================================
  Files          40       40           
  Lines        1073     1073           
  Branches      197      197           
=======================================
  Hits          893      893           
  Misses        168      168           
  Partials       12       12           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Syed-Ali-Abbas-Zaidi Syed-Ali-Abbas-Zaidi force-pushed the Ali-Abbas/fix-styles-issue branch from 186436c to 5e6ab22 Compare March 29, 2023 15:53
@abdullahwaheed
Copy link
Contributor

please attach the ticket in the description and fixed UIs screenshots as well

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants