mirror of
https://github.com/quartz-community/folder-page.git
synced 2026-07-22 02:50:24 +00:00
42 lines
1 KiB
TypeScript
42 lines
1 KiB
TypeScript
import { defineConfig } from "tsup";
|
|
|
|
export default defineConfig({
|
|
entry: {
|
|
index: "src/index.ts",
|
|
types: "src/types.ts",
|
|
"components/index": "src/components/index.ts",
|
|
},
|
|
format: ["esm"],
|
|
dts: true,
|
|
sourcemap: true,
|
|
clean: true,
|
|
treeshake: true,
|
|
target: "es2022",
|
|
splitting: false,
|
|
outDir: "dist",
|
|
esbuildOptions(options) {
|
|
options.jsx = "automatic";
|
|
options.jsxImportSource = "preact";
|
|
},
|
|
esbuildPlugins: [
|
|
{
|
|
name: "text-loader",
|
|
setup(build) {
|
|
build.onLoad({ filter: /\.scss$/ }, async (args) => {
|
|
const sass = await import("sass");
|
|
const result = sass.compile(args.path);
|
|
return { contents: result.css, loader: "text" };
|
|
});
|
|
|
|
build.onLoad({ filter: /\.inline\.ts$/ }, async (args) => {
|
|
const fs = await import("fs");
|
|
const text = await fs.promises.readFile(args.path, "utf8");
|
|
return {
|
|
contents: text,
|
|
loader: "text",
|
|
};
|
|
});
|
|
},
|
|
},
|
|
],
|
|
});
|