question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pagination component SCSS not included in production build

See original GitHub issue

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • Swiper Version: 3.1.2

  • Platform/Target and Browser Versions: macOS FIrefox + Chrome

What you did

Included Swiper (React) along with pagination:

import SwiperCore, { Pagination } from 'swiper';
import { Swiper, SwiperSlide } from 'swiper/react';
import 'swiper/swiper.scss';
import 'swiper/components/pagination/pagination.scss';

Expected Behavior

Swiper slides and pagination bullets should be styled in the production build.

Actual Behavior

Swiper slides have styles (since the sideEffects fix in 6.1.0) but pagination bullets do not have any style rules. Issue only appears in production build; development is fine.

Seems to be related to #3734 / #3708, but only with the optional components.

My first thought is that the sideEffects aren’t matching nested directories. I tried editing the sideEffects section of swiper’s package.json from e.g. *.scss to **/*.scss, but that didn’t seem to work.

Possible workaround: if I remove the scss imports from my .jsx file and move them into my .scss file (e.g. @import '~swiper/components/pagination/pagination.scss'), it seems to work. But importing them in jsx should work too.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:6

github_iconTop GitHub Comments

12reactions
johnbede2000commented, Feb 25, 2021

Using require instead of import is another quick workaround, works for me

2reactions
xughvcommented, Nov 30, 2020

image

The cause of the issue is this sideEffects.

Read more comments on GitHub >

github_iconTop Results From Across the Web

styling in react is not visible? - Stack Overflow
and the npm package says to include import "rc-pagination/assets/index.css"; line on the file . But the style is not getting applied. The style ......
Read more >
Search UI styles are not read in production build of Gatsby
As i am actively building a Site Search with SearchUI and did a production build of Gatsby, interestingly Paging is the only component...
Read more >
How to add pagination to your Next.js app - LogRocket Blog
First, we will create a new Next.js app with the command npx create-next-app ... styles/Home.module.css"; import Pagination from ".
Read more >
Compiling Assets (Mix) - The PHP Framework For Web Artisans
When you run the dev or production scripts, all of your application's CSS and JavaScript assets will be compiled and placed in your...
Read more >
Pagination - California Design System - CA.gov
Details about the pagination component, including how to use it and the steps to ... If you do not use a build system,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found