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

memory leak in webpack #15

Open
uurcank opened this issue May 15, 2021 · 12 comments
Open

memory leak in webpack #15

uurcank opened this issue May 15, 2021 · 12 comments

Comments

@uurcank
Copy link

uurcank commented May 15, 2021

I get FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory error when compiling this with webpack.

anyone else has the same problem?

@jjranalli
Copy link
Owner

Hey there! This has never happened to me, and it can depend on a number of things. If you have jit enabled, also try disabling it.

Please provide further details, especially about your tailwind and build config, so I can investigate further. And possibly provide a repo to reproduce the issue. Thanks!

@jjranalli
Copy link
Owner

@uurcank Is there any progress around this issue, or further details you can share? Otherwise I'll close this

@uurcank
Copy link
Author

uurcank commented May 19, 2021

@jjranalli can you confirm whether you are compiling with webpack?

I will work on it today and get back to you

@jjranalli
Copy link
Owner

Sorry I think I misunderstood the issue at first. I generally use Tailwindcss with the standard Nextjs installation, so I'm not directly compiling Nightwind with webpack.

I look forward to hearing what you discover about this. In the meantime feel free to share your webpack config (or a repo to reproduce the issue so I can look into this myself). Thanks!

@uurcank
Copy link
Author

uurcank commented May 20, 2021

I tried with a couple of different webpack configs and all lead to the same memory error. I am not exactly sure what is the root for this. There must be some sort of infinite loop happening somewhere.

How does this library work? Does it generate a stylesheet nested under dark class and inject that stylesheet? If not that would be a better approach and minimize the size of library.

@jjranalli
Copy link
Owner

Nightwind classes aren't currently nested under a 'dark' class, each one is being injected separately using the addComponents function provided by Tailwindcss.

This behaviour will change in the next major release of the plugin which will introduce a bunch of improvements , including how css rules are generated.

Do you think that's the cause of the issue? If you can provide me a repo to reproduce the issue I'd gladly look into it

@uurcank
Copy link
Author

uurcank commented May 20, 2021

I think so. I am testing this in a rails application, which has many pages. The script mostly likely attempts to add too many components which exceed the memory limit.

That's why I am unable to share the repo at this time. If you are familiar with rails though, adding it via yarn & webpack, should cause the same issue on your end.

@jjranalli
Copy link
Owner

Got it. Unfortunately without a reproduction repo it will probably take some time before I'm able to set this up, but I'll do what I can. If you ever manage to provide me with a reproduction repo (or at least your webpack config) that'd be ideal. Thanks!

@uurcank
Copy link
Author

uurcank commented May 22, 2021

I will try to create a test app as soon as I get the chance.

@wottpal
Copy link

wottpal commented Sep 15, 2021

Same issue with a default Next.js installation

@uurcank
Copy link
Author

uurcank commented Jul 26, 2022

@uurcank Removed webpack in Rails and switched to jsbuild. no longer getting this error.

@kanelsnurren
Copy link

kanelsnurren commented Aug 9, 2023

Nightwind is a memory-hog, use NODE_OPTIONS: "--max_old_space_size=4096", it'll fix it @uurcank @wottpal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants