mirror of
https://github.com/quartz-community/recent-notes.git
synced 2026-07-22 02:50:28 +00:00
The DtsConfig type in tsup does not have a tsconfig property.
Use top-level tsconfig option instead of dts: { tsconfig: ... }.
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { defineConfig } from "tsup";
|
|
import * as esbuild from "esbuild";
|
|
|
|
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,
|
|
outDir: "dist",
|
|
platform: "node",
|
|
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 result = await esbuild.build({
|
|
entryPoints: [args.path],
|
|
bundle: true,
|
|
write: false,
|
|
format: "iife",
|
|
target: "es2022",
|
|
minify: false,
|
|
platform: "browser",
|
|
});
|
|
const code = result.outputFiles?.[0]?.text ?? "";
|
|
return {
|
|
contents: `export default ${JSON.stringify(code)};`,
|
|
loader: "ts",
|
|
};
|
|
});
|
|
},
|
|
},
|
|
],
|
|
});
|