Files
hugo/common
Bjørn Erik Pedersen ae7bf74b3e common/hexec: Make NODE_PATH a fallback for ESM bare imports
Node's ESM resolver does not consult NODE_PATH (unlike CJS require), so
an ESM postcss.config.js shipped by a Hugo theme fails when loaded from
the module cache: bare imports like `import x from "postcss-import"`
have no node_modules to walk up to.

Install a synchronous resolver hook (module.registerHooks) via
--import=data:... on every Node invocation. On ERR_MODULE_NOT_FOUND for
a bare specifier it resolves the package from each NODE_PATH entry via
createRequire().resolve(). No-op for relative, absolute, URL-scheme and
non-MODULE_NOT_FOUND failures. Synchronous hooks run on the main thread,
so no --allow-worker is needed under the Node permission model.

Fixes #13987

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 22:00:04 +02:00
..
2026-03-07 18:30:42 +01:00
2026-03-07 18:30:42 +01:00
2025-11-05 21:05:42 +01:00
2025-11-05 21:05:42 +01:00
2024-11-14 15:05:37 +01:00
2026-05-13 10:07:26 +02:00
2026-04-23 20:05:09 +02:00
2025-02-26 11:44:25 +01:00
2025-02-26 11:44:25 +01:00
2025-11-05 21:05:42 +01:00
2026-03-07 18:30:42 +01:00