fix: compile SCSS via sass instead of raw text to prevent lightningcss errors

This commit is contained in:
saberzero1 2026-02-26 16:44:51 +01:00
parent 7c2b9d663b
commit 1db52f8a13
No known key found for this signature in database
3 changed files with 383 additions and 107 deletions

483
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -82,6 +82,7 @@
"eslint-config-prettier": "^9.1.0",
"preact": "^10.28.2",
"prettier": "^3.6.2",
"sass": "^1.97.3",
"vitest": "^2.1.9"
},
"engines": {

View file

@ -8,9 +8,9 @@ const inlineScriptPlugin: Plugin = {
const absWorkingDir = parentBuild.initialOptions.absWorkingDir ?? process.cwd();
parentBuild.onLoad({ filter: /\.scss$/ }, async (args) => {
const fs = await import("fs");
const text = await fs.promises.readFile(args.path, "utf8");
return { contents: text, loader: "text" };
const sass = await import("sass");
const result = sass.compile(args.path);
return { contents: result.css, loader: "text" };
});
parentBuild.onLoad({ filter: /\.inline\.ts$/ }, async (args) => {