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

docs: add warning about dynamic import of css #21805

Merged
merged 7 commits into from
Jun 27, 2023
Merged

Conversation

InerkyJad
Copy link
Contributor

@InerkyJad InerkyJad commented Jun 26, 2023

The warning is regarding the use of dynamic imports inside of the script tag, it's related to #21803

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

The warning is regarding the use of dynamic imports inside of the script tag, it's related to nuxt#21803
@nuxt-studio
Copy link

nuxt-studio bot commented Jun 26, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
Nuxt Docs Edit on Studio β†—οΈŽ View Live Preview f5bbab6

@MuhammadM1998
Copy link
Contributor

Hello,
Maybe you can add an example of a static import ( import "./style.css) too as the current line maybe confusing.

Is this seems better?

Make sure to use a **synchronous** import `import "./style.css` instead of a **dynamic** import `import("~/assets/style.css")` for server-side compatibility.

Copy link
Contributor

@florian-lefebvre florian-lefebvre left a comment

Choose a reason for hiding this comment

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

I agree with @MuhammadM1998, adding an example of synchronous import is less confusing. Could you add it?

@florian-lefebvre
Copy link
Contributor

@Hebilicious can you review?

@danielroe
Copy link
Member

danielroe commented Jun 27, 2023

Maybe add this as a comment to the existing example of synchronous import above on L21?

@danielroe danielroe changed the title feat: added a warning to 4.styling.md docs: add warning about dynamic import of css Jun 27, 2023
Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

Thank you - perfect!

Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
@danielroe danielroe merged commit dc329c3 into nuxt:main Jun 27, 2023
2 checks passed
@github-actions github-actions bot mentioned this pull request Jun 27, 2023
@InerkyJad InerkyJad deleted the patch-1 branch June 27, 2023 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants