From 471e88b3e69490f8ccd63b8c47adff18664c8f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Guti=C3=A9rrez?= <35082514+alezmad@users.noreply.github.com> Date: Thu, 9 Apr 2026 00:52:39 +0100 Subject: [PATCH] fix(web): stub .scss/.sass/.less in addition to .css in ESM loader --- apps/web/css-stub-loader.mjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web/css-stub-loader.mjs b/apps/web/css-stub-loader.mjs index 743c698..812bea4 100644 --- a/apps/web/css-stub-loader.mjs +++ b/apps/web/css-stub-loader.mjs @@ -13,15 +13,17 @@ import { register } from "node:module"; register( "data:text/javascript," + encodeURIComponent(` +const STYLE_RE = /\\.(css|scss|sass|less)$/; + 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 nextResolve(specifier, context); } export function load(url, context, nextLoad) { - if (url.endsWith('.css')) { + if (STYLE_RE.test(url)) { return { format: 'module', source: 'export default {};', shortCircuit: true }; } return nextLoad(url, context);