-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsup.config.ts
More file actions
48 lines (47 loc) · 1.23 KB
/
tsup.config.ts
File metadata and controls
48 lines (47 loc) · 1.23 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// @ts-nocheck - esbuild version mismatch between tsup's bundled esbuild and standalone esbuild
import { defineConfig, Options } from 'tsup';
import svgrPlugin from 'esbuild-plugin-svgr';
export default defineConfig({
// Keep per-icon modules so consumers can tree-shake and only import what they need.
entry: [
'src/index.ts',
'src/icon-types.ts',
'src/dynamicIconImports.ts',
'src/icons/index.ts',
'src/icons/*.tsx',
],
format: ['esm', 'cjs'],
// Generate declarations for all entrypoints (including per-icon modules)
dts: true,
clean: true,
sourcemap: true,
minify: false,
treeshake: true,
splitting: false,
preserveModules: true,
// Bundle upstream icons so consumers don't need loaders for .svg/.tsx in node_modules
noExternal: ['@hackernoon/pixel-icon-library'],
esbuildPlugins: [
svgrPlugin({
exportType: 'default',
svgo: true,
svgoConfig: {
plugins: [
{
name: 'removeAttrs',
params: {
attrs: '(id)',
},
},
],
},
}) as any,
],
target: 'es2020',
outDir: 'dist',
outExtension({ format }) {
return {
js: format === 'cjs' ? '.cjs' : '.js',
};
},
} as Options);