-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Closed
Description
Version
22.18.0
Platform
Linux lttm77 6.1.43 #1 SMP PREEMPT_DYNAMIC Sun Aug 6 20:05:33 UTC 2023 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
Use this codesandbox and run yarn test
.
How often does it reproduce? Is there a required condition?
When using --import
option to override the load
hook with registerHooks
to ignore CSS files.
What is the expected behavior? Why is that the expected behavior?
Node should use the provided hook to ignore CSS imports. But the provided load
hook never returns a null "source" so the error doesn't make any sense.
What do you see instead?
The following stacktrace with node 22.16.0
or 22.18.0
:
node:internal/modules/customization_hooks:276
throw new ERR_INVALID_RETURN_PROPERTY_VALUE(
^
TypeError [ERR_INVALID_RETURN_PROPERTY_VALUE]: Expected a string, an ArrayBuffer, or a TypedArray to be returned for the "source" from the "load" hook but got undefined.
at validateLoad (node:internal/modules/customization_hooks:276:11)
at nextStep (node:internal/modules/customization_hooks:190:14)
at load (file:///project/workspace/tests/node-ignore-css.mjs:8:12)
at nextStep (node:internal/modules/customization_hooks:185:26)
at loadWithHooks (node:internal/modules/customization_hooks:348:18)
at #loadSync (node:internal/modules/esm/loader:834:14)
at ModuleLoader.load (node:internal/modules/esm/loader:793:28)
at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:580:43)
at #createModuleJob (node:internal/modules/esm/loader:604:36)
at #getJobFromResolveResult (node:internal/modules/esm/loader:338:34) {
code: 'ERR_INVALID_RETURN_PROPERTY_VALUE'
}
Or this one with node 22.17.1
:
node:internal/assert:17
throw new ERR_INTERNAL_ASSERTION(message);
^
Error [ERR_INTERNAL_ASSERTION]: Unexpected module status 3.
This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
at Function.fail (node:internal/assert:17:9)
at ModuleJob.runSync (node:internal/modules/esm/module_job:317:12)
at require (node:internal/modules/esm/translators:149:9)
at Object.<anonymous> (/project/workspace/node_modules/playwright-core/lib/server/registry/browserFetcher.js:44:16)
at loadCJSModule (node:internal/modules/esm/translators:164:3)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:200:7)
at ModuleJob.runSync (node:internal/modules/esm/module_job:309:39)
at require (node:internal/modules/esm/translators:149:9)
at Object.<anonymous> (/project/workspace/node_modules/playwright-core/lib/server/registry/index.js:45:29)
at loadCJSModule (node:internal/modules/esm/translators:164:3) {
code: 'ERR_INTERNAL_ASSERTION'
}
Additional information
I'm trying to upgrade my React app from MUI-X 7 to 8. They introduced a CSS import that needs to be ignored (as discussed in mui/mui-x#17427) with the following code:
// node-ignore-css.js
// Needs to be loaded before your code runs:
// node --import ./node-ignore-css.js ./index.js
import { registerHooks } from 'node:module';
registerHooks({
load(url, context, nextLoad) {
if (url.endsWith('.css')) {
return { url, format: 'module', source: '', shortCircuit: true };
}
return nextLoad(url, context);
},
});
I'm trying to run Playwright tests with this ignore config, but I'm getting the above error.
Metadata
Metadata
Assignees
Labels
No labels