-
Notifications
You must be signed in to change notification settings - Fork 4
/
tsup.config.ts
38 lines (33 loc) · 1.03 KB
/
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
35
36
37
38
import { toBoolean } from './src/utils/utils';
import type { Format, Options } from 'tsup';
const format: Format[] = ['cjs', 'esm', 'iife'];
const env: 'production' | 'development' =
process.env.NODE_ENV === 'production' ? 'production' : 'development';
const isProd = env === 'production';
const singleBundleFile = toBoolean(process.env.BUNDLE_ALL);
const inlinePackagePatterns = singleBundleFile
? [/lodash\/.*/, 'ms', /expressionparser\/.*/]
: [];
export default <Options>{
format,
outDir: 'dist',
platform: 'node',
target: 'node14',
entry: ['src/index.ts'],
globalName: 'RulesMachine',
clean: true,
bundle: true,
metafile: true,
minify: isProd,
resolve: true,
dts: {
resolve: true,
// build types for `src/index.ts` only
// otherwise `Options` will not be exported by `tsup`, not sure how this happens, probably a bug in rollup-plugin-dts
entry: './src/index.ts',
},
skipNodeModulesBundle: singleBundleFile,
sourcemap: true,
// splitting: false,//
noExternal: inlinePackagePatterns,
};