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]: val-loader and val-loader-modernizr fails #9635

Open
kamranayub opened this issue Mar 12, 2025 · 2 comments
Open

[Bug]: val-loader and val-loader-modernizr fails #9635

kamranayub opened this issue Mar 12, 2025 · 2 comments

Comments

@kamranayub
Copy link

kamranayub commented Mar 12, 2025

System Info

  System:
    OS: Windows 10 10.0.26100
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 24.87 GB / 63.91 GB
  Binaries:
    Node: 20.15.1 - ~\AppData\Local\fnm_multishells\78476_1741742697525\node.EXE
    npm: 10.7.0 - ~\AppData\Local\fnm_multishells\78476_1741742697525\npm.CMD
    pnpm: 9.9.0 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Edge: Spartan (38.35), Chromium (38.3), ChromiumDev (38.21)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    @rspack/cli: ^1.2.8 => 1.2.8
    @rspack/core: ^1.2.8 => 1.2.8

Details

I was testing out rspack moving from Webpack and I use val-loader together with https://www.npmjs.com/package/val-loader-modernizr

When I execute the build, I get this error:

> rspack -c rspack.config.js

ERROR in ./scripts/.modernizrrc
  × Error:  on JsLoaderContext.additionalData
  │     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)


Rspack compiled with 1 error in 58.20 s

The time taken probably reflects my ts-loader as it takes about 60 seconds to typecheck.

The rule looks like:

{
                test: /\.modernizrrc$/,
                use: [{
                    loader: 'val-loader',
                    options: {
                        executableFile: require.resolve('val-loader-modernizr')
                    }
                }]
}

Note: In ESM module in repro, I use fileURLToPath(import.meta.resolve("val-loader-modernizr")) but in my project I'm still using CommonJS config.

Reproduce link

https://github.com/kamranayub/rspack-bug-val-loader

Reproduce Steps

  1. pnpm install (or bun install)
  2. npm run build or (pnpm run build)
  3. Observe error
@kamranayub kamranayub added the pending triage The issue/PR is currently untouched. label Mar 12, 2025
@kamranayub
Copy link
Author

I also tried the minimal Modernizr example here: https://www.npmjs.com/package/val-loader#modernizr

Same deal, just FYI.

@kamranayub
Copy link
Author

It seems like this one works!

https://www.npmjs.com/package/@sect/modernizr-loader

I don't know if it's an issue with val-loader or the val-loader-modernizr but I suppose this is a workaround.

@inottn inottn removed the pending triage The issue/PR is currently untouched. label Mar 12, 2025
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

2 participants