turf/tsup.config.ts
James Beard 0ce6ecca05
Reduce bundle size of apps that import @turf/helpers (#2623)
* Remove GeojsonEquality library from turf-helpers/lib/ in favour of the third party geojson-equality-ts (which is essentially a copy of the code we're removing from turf-helpers/lib/). This allows us to remove the dependency on deep-equal which was causing an unintended increase in bundle size for users of turf-helpers. Updated boolean-equal and boolean-overlap to use geojson-equality-ts directly.

* Removing keepNames from tsup config.

---------

Co-authored-by: Tim Welch <tim.j.welch@gmail.com>
2024-06-25 22:57:25 +10:00

29 lines
606 B
TypeScript

import { defineConfig, type Options } from "tsup";
const baseOptions: Options = {
clean: true,
dts: true,
entry: ["index.?s"], // while we have a mix of TS and JS packages
minify: false,
skipNodeModulesBundle: true,
sourcemap: true,
target: "es2017",
tsconfig: "./tsconfig.json",
// treeshake: true, causes "chunk.default" warning, breaks CJS exports?
cjsInterop: true,
splitting: true,
};
export default [
defineConfig({
...baseOptions,
outDir: "dist/cjs",
format: "cjs",
}),
defineConfig({
...baseOptions,
outDir: "dist/esm",
format: "esm",
}),
];