possible to use Swiper with NextJS without having to import css in app.js? #7187
Unanswered
kimvuVarner
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In NextJS, all global css has to be imported in pages/_app.js ref https://nextjs.org/learn-pages-router/basics/assets-metadata-css/global-styles. So in order to have swiper working correctly we need to have that import in app.js. The problem with that is that the swiper css will allways be included even though we don't have any swiper in the current view. This increases bundle size and is something we are a bit concerned with
So what I want is a way to only import the css when swiper is in use (lazyloading) and not have to include it in my app.js
Has anyone thought of this?
Beta Was this translation helpful? Give feedback.
All reactions