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 33cefa3492
commit 4d81b1ec63
No known key found for this signature in database
3 changed files with 383 additions and 110 deletions

483
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -73,6 +73,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

@ -22,12 +22,9 @@ export default defineConfig({
name: "text-loader",
setup(build) {
build.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" };
});
build.onLoad({ filter: /\.inline\.ts$/ }, async (args) => {