-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtsup.config.ts
34 lines (32 loc) · 911 Bytes
/
tsup.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { defineConfig } from 'tsup';
const commonOptions = {
entry: ['src/index.ts', 'src/debug.ts'],
splitting: false,
sourcemap: true,
clean: true,
minify: true,
};
export default defineConfig(() => [
{
...commonOptions,
format: ['esm'],
outExtension: () => ({ js: '.mjs' }),
dts: true,
clean: true,
},
{
...commonOptions,
format: 'cjs',
outDir: './dist/cjs/',
outExtension: () => ({ js: '.cjs' }),
esbuildOptions: (options) => {
options.footer = {
// This will ensure we can continue writing this plugin
// as a modern ECMA module, while still publishing this as a CommonJS
// library with a default export, as that's how ESLint expects plugins to look.
// @see https://github.com/evanw/esbuild/issues/1182#issuecomment-1011414271
js: 'module.exports = module.exports.default;',
};
},
},
]);