Files
PMTiles/openlayers/tsup.config.ts
Brandon Liu d4595793ad ol-pmtiles 2.0.1 (#530)
* fix IIFE build by specifying platform=browser to esbuild
2025-02-21 15:39:36 +08:00

46 lines
861 B
TypeScript

import { defineConfig, type Options } from "tsup";
const baseOptions: Options = {
clean: true,
minify: false,
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: "olpmtiles",
entry: {
"olpmtiles": "src/index.ts",
},
outExtension: () => {
return { js: ".js" };
},
}),
];