Skip to content

Commit

Permalink
type-check tsup config
Browse files Browse the repository at this point in the history
  • Loading branch information
emma-sg committed Nov 8, 2023
1 parent 1b7572d commit 73fe89b
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,35 @@
import { defineConfig } from 'tsup';
import { Options, defineConfig } from "tsup";

const sharedConfig = {
const sharedConfig: Partial<Options> = {
dts: true,
minify: true,
shims: true,
splitting: false
}

splitting: false,
};

const nodeConfig = {
const nodeConfig: Options = {
...sharedConfig,
clean: true,
entry: ["src/index.ts", "src/cli.ts", "src/utils.ts", "src/node/index.ts"],
platform: "node",
format: ["esm", "cjs"],
}

};

const browserConfig = {
const browserConfig: Options = {
...sharedConfig,
clean: false,
entry: ["src/index.ts"],
platform: "browser",
format: ["esm"],
outExtension() {
return {
js: `.all.js`,
}
js: ".all.js",
};
},
sourcemap: true,
noExternal: ["pako", "uuid-random", "base32-encode"]
noExternal: ["pako", "uuid-random", "base32-encode"],
};


export default defineConfig((options) => {
if (options.define && options.define.browser) {
return browserConfig;
Expand Down

0 comments on commit 73fe89b

Please sign in to comment.