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

[Bug]: Too many files open error when using builtin:swc-loader #8318

Open
KidkArolis opened this issue Nov 2, 2024 · 3 comments
Open

[Bug]: Too many files open error when using builtin:swc-loader #8318

KidkArolis opened this issue Nov 2, 2024 · 3 comments
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.

Comments

@KidkArolis
Copy link

System Info

System:
OS: macOS 15.1
CPU: (8) arm64 Apple M1
Memory: 146.88 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.9.0 - ~/.asdf/installs/nodejs/22.9.0/bin/node
npm: 10.8.3 - ~/.asdf/plugins/nodejs/shims/npm
pnpm: 9.11.0 - ~/.asdf/shims/pnpm
Watchman: 2024.09.09.00 - /opt/homebrew/bin/watchman

Details

If I replace swc-loader with builtin:swc-loader I get the following error on every build:

× Module build failed:
╰─▶ × Too many open files (os error 24), failed to read

Here's the relevant bit of rspack config:

{
    test: /\.(js|mjs|jsx)$/,
    exclude: /(node_modules)/,
    use: [
      {
        loader: 'builtin:swc-loader',
        // loader: require.resolve('swc-loader'),
        options: {
          env: {
            targets: browsers.query(options),
            coreJs: 3,
            mode: 'entry'
          },
          jsc: {
            parser: {
              syntax: 'ecmascript',
              exportDefaultFrom: true,
              jsx: true
            },
            externalHelpers: true,
            transform: {}
          }
        }
      }
    ]
  }

My ulimit is low with ulimit -n showing 256. But if I update with ulimit -n 64000 that doesn't help.

Reproduce link

No response

Reproduce Steps

Unsure at this time, doesn't reproduce on a smaller repo, only on my larger production app. Can try and put together a large example.. But maybe you know why this error would be thrown.

@KidkArolis KidkArolis added bug Something isn't working pending triage The issue/PR is currently untouched. labels Nov 2, 2024
@KidkArolis
Copy link
Author

Ah, but an interesting here is that all the errors are on reading .scss files specifically, which are also css modules. Is something off when converting those to JS? Example:

ERROR in ./src/pages/Profile/components/Verified/Verified.scss
  × Module build failed:
  ╰─▶   × Error: HookWebpackError:   × Module build failed:
        │   ╰─▶   × Error: EMFILE: too many open files, open '/Users/karolis/app/client/styles/foundation/duration.scss'

@KidkArolis
Copy link
Author

OK, if I use both require('swc-loader') for js + require('postcss-loader') for scss, that works. But builtin:swc-loader with require('postcss-loader') does not work. But using builtin:swc-loader and removing require('postcss-loader') from the chain builds successfully.

@KidkArolis
Copy link
Author

Also happens when using builtin:swc-loader with builtin:lightningcss-loader, but more rarely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.
Projects
None yet
Development

No branches or pull requests

1 participant