Files
PMTiles/js/tsup.config.ts
Brandon Liu 7ed6377031 js 4.0.1 (#501)
fix iife build - tell esbuild to use browser platform for fflate dependency.
2024-11-26 12:56:26 +08:00

45 lines
855 B
TypeScript

import { defineConfig, type Options } from "tsup";
const baseOptions: Options = {
clean: true,
minify: true,
skipNodeModulesBundle: true,
sourcemap: true,
target: "es6",
tsconfig: "./tsconfig.json",
keepNames: true,
cjsInterop: true,
splitting: true,
};
export default [
defineConfig({
...baseOptions,
entry: ["src/index.ts"],
outDir: "dist/cjs",
format: "cjs",
dts: true,
}),
defineConfig({
...baseOptions,
entry: ["src/index.ts"],
outDir: "dist/esm",
format: "esm",
dts: true,
}),
defineConfig({
...baseOptions,
esbuildOptions: (options) => {
options.platform = "browser";
},
outDir: "dist",
format: "iife",
globalName: "pmtiles",
entry: {
"pmtiles": "src/index.ts",
},
outExtension: () => {
return { js: ".js" };
},
}),
];