fix(web): stub .scss/.sass/.less in addition to .css in ESM loader
Some checks failed
CI / Lint (push) Has been cancelled
CI / Typecheck (push) Has been cancelled
CI / Broker tests (Postgres) (push) Has been cancelled
CI / Docker build (linux/amd64) (push) Has been cancelled

This commit is contained in:
Alejandro Gutiérrez
2026-04-09 00:52:39 +01:00
parent c66e3adf67
commit 471e88b3e6

View File

@@ -13,15 +13,17 @@ import { register } from "node:module";
register( register(
"data:text/javascript," + "data:text/javascript," +
encodeURIComponent(` encodeURIComponent(`
const STYLE_RE = /\\.(css|scss|sass|less)$/;
export function resolve(specifier, context, nextResolve) { export function resolve(specifier, context, nextResolve) {
if (specifier.endsWith('.css')) { if (STYLE_RE.test(specifier)) {
return { url: 'data:text/javascript,export default {};', shortCircuit: true }; return { url: 'data:text/javascript,export default {};', shortCircuit: true };
} }
return nextResolve(specifier, context); return nextResolve(specifier, context);
} }
export function load(url, context, nextLoad) { export function load(url, context, nextLoad) {
if (url.endsWith('.css')) { if (STYLE_RE.test(url)) {
return { format: 'module', source: 'export default {};', shortCircuit: true }; return { format: 'module', source: 'export default {};', shortCircuit: true };
} }
return nextLoad(url, context); return nextLoad(url, context);