Compiling Nextjs with Tailwind typically takes anywhere from 8 to 16 seconds

My first time using tailwind has resulted in slow compilation times when used with nextjs in development mode.

The slowdown can be confirmed by simply removing the following code:

@tailwind base;
@tailwind components;
@tailwind utilities;

This significantly reduces the compilation time. I've attempted to improve the performance by utilizing jit and splitting the CSS file, but unfortunately, these solutions have not worked for me. How can I resolve this issue?

https://i.sstatic.net/HLHWG.png

https://i.sstatic.net/CBl67.png

    /** @type {import('tailwindcss').Config} */
const { shake } = require("./app/global/configStore/tailwind/animations");

module.exports = {
  mode: "jit",
  theme: {
    extend: {
      keyframes: {
        shake: { ...shake },
      },
      animation: {
        "error-shake": "shake 0.5s linear",
      },
    },
  },
  content: [
    "./public/*.html",
    "./pages/**/*.{js,ts,jsx,tsx,mdx}",
    "./app/components/**/*.{js,ts,jsx,tsx,mdx}",
    "./app/**/*.{js,ts,jsx,tsx,mdx}",
  ],
  safelist: [
    {
      pattern: /(bg|text|border)-./,
    },
  ],
  options: {},
  plugins: [],
};

I haven't made any configurations in the postcss.config.js file and I start my server using yarn run dev. Any assistance would be greatly appreciated. Thank you!

Answer №1

One option is to rethink the safelist approach, or alternatively, tighten up the regular expression to target fewer class possibilities.

The reason being that the existing safelist pattern could potentially match an overwhelming number of class options, resulting in a surge of rules and ultimately slowing down the process.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is there a technique I could use to create a visual effect like zooming, but without altering the dimensions of the image?

I'm currently working on a project to develop a photo gallery. let img = document.createElement('img') img.src = "https://upload.wikimedia.org/wikipedia/commons/thumb/0/07/Wikipedia_logo_%28svg%29.svg/1250px-Wikipedia_logo_%28svg% ...

Achieving Vertical Alignment in a Bootstrap 4 Image Overlay Card

I am facing a challenge in trying to vertically center a FontAwesome icon within an Image Overlay Card. Despite attempting various methods like using d-flex and justify-content-center, none of them seem to be effective. What could I be overlooking? < ...

The height of the <div> element is not increasing along with the content inside. If I set the height to "auto

I encountered an issue with my webpage design. It has set dimensions with blue borders on the sides and bottom. The problem arises when I add Facebook comments to the page - as more comments are added, they extend beyond the bottom of the webpage, below ...

Converting a ReadStream to a ReadableStream in NodeJS: A Step-by-Step Guide

This question poses the opposite scenario to converting a ReadableStream into a ReadStream. ReadStream is a data structure utilized in Node.js ReadableStream is a structure that comes from the web platform, as detailed here As new runtimes like Deno or t ...

Issues arise when setting a delay for CSS transitions to occur due to the

I'm trying to create a scroll bar that only appears when hovered over, similar to how it works on Facebook where the scroll bar shows up slowly instead of all at once. I've tried using CSS transition delay, but it doesn't seem to be working ...

How can I wrap content with the <li> element in a cross-browser compatible way?

I am encountering an issue with the dropdown menu on my website located at . When hovering over elements with a dropdown menu, you may notice that some of the items within the dropdown span more than one line and have varying widths. My goal is to adjust ...

Fading Out with JQuery

My page contains about 30 same-sized divs with different classes, such as: .mosaic-block, .events, .exhibitions, .gallery, .sponsors, .hospitality, .workshops, .lectures { background:rgba(0, 0, 0, .30); float:left; position:relative; overf ...

The table does not recognize any of the CSS classes when the TAG is inputted inside

I am currently working on a challenging form for players to save their personal character sheets in a database. To achieve this, I am incorporating numerous Input TAGs and utilizing tables for layout purposes, ensuring an organized and efficient design. E ...

What steps should I take to fix a Dockerfile build error in a Next.js static app that reads "Error: Module [X] not found"?

Currently, I am in the process of creating a production Next.js static Docker image following the successful setup of a development Docker environment. However, I am facing several challenges during the build phase. Despite my efforts to troubleshoot based ...

Incorporate CSS and JavaScript files into every page of NetSuite

Is there a way to globally apply a CSS file or JavaScript code to all NetSuite pages in order to change the page direction to RTL? I attempted adding it through: SuiteScript >> Client >> Deployment : All Records, While I was able to successfu ...

Error encountered during compression of build artifacts with exit status 2

An issue occurred when attempting to deploy the application to Cloud Foundry following the installation of packages. Application type: Next.js ...

Inquiring about the versatility of NextJS Stripe Elements for various scenarios

Currently, I am in the process of developing an online store using NextJS (Typescript) and Stripe. Everything has been going smoothly so far except for one issue... The problem arises from having my entire application wrapped within an Elements component: ...

The expected property 'label' is not found in the object type '{ handleClick: () => void; }', but it is required in the object type '{ handleClick: () => void; label: string; }'

I'm encountering difficulties when describing the types of my props. The issue arises with the following code: <PostButton handleClick={props.upvote}/> <PostButton2 handleClick={props.downvote}/> An error message is displayed: Pro ...

Troubleshooting: Jquery Toggle Issue When Used with Adjacent Div Element

I've been puzzling over this issue for hours now. The intention of this code is to display a div, but it's just not cooperating. <div id="butbr"> <div id="sup_nav"> <div id="stup" class="bxt1"></div> <div id= ...

Update content without reloading the page

I've implemented a function to delete an image in my action.js file: export const removeImage = (id, image_id) => async () => { try { const response = await axios.delete( `localhost:3000//api/v1/posts/${id}/delete/${image_id}`, ...

Next.js encountered a 405 error indicating that the method used for redirect after form submission (POST) is not allowed

After submitting a form using the POST method to an API route in next.js, I process the body content and store the form data. My intention is to then redirect to a thank you page. The structure of the API route is as follows: export default async function ...

Error in NextJs: The text content does not align with the server-rendered content

I am working on a new project using "NextJs", "date-fns", and "React-Calendar". However, I am facing an issue with date rendering between the server side (nodejs =english format) and client side (french): Warning: Text content did not match. Server: "April ...

In production, all Next.js API routes consistently return an "Interval Server Error," whereas in development, all routes operate smoothly without any issues

Every time I access any API route in my Next.js application in production, it results in a 500 "Internal Server Error". However, in development mode, all routes function smoothly and provide the expected output. https://i.stack.imgur.com/nPpeV.png https: ...

Tips for avoiding the freezing of bootstrap-select scroll when a large number of options are present

I have integrated a bootstrap-select with a total of 1000 options. However, I am encountering an issue where when I attempt to scroll down the list of options, it only goes down approximately 60 options and then freezes in that position. Can anyone provi ...

React-table column hidden on mobile screen due to Tanstack customization

Need some advice on how to hide specific columns in a react-table when viewed on a mobile screen. Using Tanstack Table along with Tailwind CSS for styling. ...