fix(web): inline CSS stub loader for Vercel path resolution

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-04-13 09:34:56 +01:00
parent a890a1d92e
commit b2999878c4

View File

@@ -1,3 +1,10 @@
import { register } from "node:module"; import { register } from "node:module";
import { pathToFileURL } from "node:url"; register("data:text/javascript," + encodeURIComponent(`
register("./css-stub-loader.mjs", pathToFileURL("./")); const STUB_EXT = ['.css', '.scss', '.sass', '.svg', '.png', '.jpg', '.jpeg', '.gif', '.ico', '.woff', '.woff2', '.ttf', '.eot'];
export function resolve(specifier, context, nextResolve) {
if (STUB_EXT.some(ext => specifier.endsWith(ext))) {
return { url: 'data:text/javascript,export default ""', shortCircuit: true };
}
return nextResolve(specifier, context);
}
`));