mirror of
https://github.com/quartz-community/content-meta.git
synced 2026-07-22 02:50:23 +00:00
60 lines
1.4 KiB
TypeScript
60 lines
1.4 KiB
TypeScript
import { defineConfig } from "tsup";
|
|
|
|
const SINGLETON_EXTERNALS = [
|
|
"preact",
|
|
"preact/hooks",
|
|
"preact/jsx-runtime",
|
|
"preact/compat",
|
|
"@jackyzha0/quartz",
|
|
"@jackyzha0/quartz/*",
|
|
"vfile",
|
|
"vfile/*",
|
|
"unified",
|
|
];
|
|
|
|
export default defineConfig({
|
|
entry: {
|
|
index: "src/index.ts",
|
|
"components/index": "src/components/index.ts",
|
|
},
|
|
format: ["esm"],
|
|
dts: true,
|
|
tsconfig: "tsconfig.build.json",
|
|
sourcemap: true,
|
|
clean: true,
|
|
treeshake: true,
|
|
target: "es2022",
|
|
splitting: false,
|
|
noExternal: [/.*/],
|
|
external: SINGLETON_EXTERNALS,
|
|
outDir: "dist",
|
|
platform: "node",
|
|
banner: {
|
|
js: 'import { createRequire } from "module"; const require = createRequire(import.meta.url);',
|
|
},
|
|
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",
|
|
};
|
|
});
|
|
},
|
|
},
|
|
],
|
|
});
|