Skip to content

Next.js 10.0.3 gives Javascript heap out of memory error in dev environment with Tailwind CSS (PostCSS Plugin) #20445

@ceodigvijay

Description

@ceodigvijay

Describe the problem:
I am using TailwindCSS 2.0.2 with Next.js 10.0.3.
TailwindCSS plugin is causing very high memory requirement for Next.js (Node.js process eats all memory), sometimes it also throws Javascript heap out of memory error.

Hot reloading is slow (even if I manage it in some way) but the real pain is Next.js+tailwinds setup takes 3-4x memory compared to others (like I was using Bulma)
With Next.js+Bulma/Bootstrap setup = ~250mb
With Next.js+TailwindCSS as PostCSS plugin = ~800mb-1.5gb memory

Link to a minimal reproduction:
Clone this repo.
https://github.com/vercel/next.js/tree/canary/examples/with-tailwindcss

and run it in next.js dev environment and watch out your memory usage (generally it remains around 200-300MB but with Tailwinds 1.2GB).

I tried to debug it and as soon as I disable tailwinds plugin in PostCSS everything again goes normal.

The real problem seems to be in tailwinds PostCSS Plugin, is there any way to reduce memory usage or fix this issue?

PS: The real problem is I don't want to trigger Out of memory error on the server during the build time.
I am using UBUNTU 20.04 on the local system (just to know this is not a problem related to OS).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions