Closed Kysluss closed 8 months ago
Do you use Windows? Do you have this error on Linux (you can test on Github Actions)
Hello,
I am on windows. Unfortunately, I don't have access to try this on Linux. I will try on github actions, but the repo I am contributing to does not have those set up and I do not have access to set them up.
Seems like we need to put pathToUrl()
somewhere. We do not have this problem on Linux, because it doesn’t have disk prefix.
The main problem that I can’t reproduce the error and stacktrace doesn’t help us.
So you will need to debug Size Limit on your Windows machine. Use debugger or console.log()
to find what lines are executed and where Size Limit falls.
I confirm that this bug happened only on Windows OS. But this commit - https://github.com/ai/size-limit/commit/67a52d2b51bc49e766ef741363415898d9ec8f1f fixed the error. The reason was that on Windows argument of dynamic import was something like - _C:\Users\ASM017\Desktop\my-app\nodemodules\@size-limit\file\index.js. Now the argument is a module name and it works correctly.
Thank you. I confirmed this resolved the error as well.
After updating from version 9.0.0 to 10.0.2, I get the below error when attempting to run
size-limit
orsize-limit --why
. I have made a repro project which is basically just a new react app initialized andsize-limit
installed.Steps to reproduce on Windows:
yarn
to initialize reproyarn build
followed byyarn analyze
to see that it works on v9yarn upgrade-interactive --latest
to upgrade all the packages to latest versionRun
yarn build
followed byyarn analyze
and you will get the below error messageERROR Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' at new NodeError (node:internal/errors:406:5) at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:216:11) at defaultLoad (node:internal/modules/esm/load:118:3) at ModuleLoader.load (node:internal/modules/esm/loader:396:13) at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:56) at new ModuleJob (node:internal/modules/esm/module_job:65:26) at #createModuleJob (node:internal/modules/esm/loader:290:17) at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:248:34) at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:229:17) at async ModuleLoader.import (node:internal/modules/esm/loader:315:23)