Skip to content

Commit 808729f

Browse files
Fix tsdown 0.20.1 build configuration
- Add inlineOnly: false to suppress dependency bundling warnings - Add skipNodeModulesBundle: true for ESM and CJS formats - Update resolve.alias configuration for UMD format - Fix outputOptions for UMD to properly remove dir option Co-authored-by: arthurfiorette <[email protected]>
1 parent 1966eec commit 808729f

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

tsdown.config.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,21 @@ function buildConfig(overrides: UserConfig) {
1919
entry: 'src/index.ts',
2020
tsconfig: 'tsconfig.build.json',
2121
clean: true,
22+
inlineOnly: false, // Suppress bundling warnings for all formats
2223
format: {
2324
esm: {
2425
platform: 'neutral',
2526
target: ['esnext'],
2627
sourcemap: true,
27-
minify: !!process.env.MINIFY
28+
minify: !!process.env.MINIFY,
29+
skipNodeModulesBundle: true // Don't bundle dependencies
2830
},
2931
cjs: {
3032
platform: 'node',
3133
target: ['esnext'],
3234
sourcemap: true,
33-
minify: !!process.env.MINIFY
35+
minify: !!process.env.MINIFY,
36+
skipNodeModulesBundle: true // Don't bundle dependencies
3437
},
3538
umd: {
3639
plugins: [!!process.env.BUNDLE && unstableRolldownAdapter(analyzer())],
@@ -42,16 +45,22 @@ function buildConfig(overrides: UserConfig) {
4245
globalName: 'AxiosCacheInterceptor',
4346

4447
// Parse dependencies source code to better tree shake them
45-
alias: {
46-
'object-code': import.meta.resolve('object-code/src/index.ts'),
47-
'http-vary': import.meta.resolve('http-vary/src/index.ts'),
48-
'cache-parser': import.meta.resolve('cache-parser/src/index.ts'),
49-
'fast-defer': import.meta.resolve('fast-defer/src/index.ts')
48+
resolve: {
49+
alias: {
50+
'object-code': path.resolve('./node_modules/object-code/src/index.ts'),
51+
'http-vary': path.resolve('./node_modules/http-vary/src/index.ts'),
52+
'cache-parser': path.resolve('./node_modules/cache-parser/src/index.ts'),
53+
'fast-defer': path.resolve('./node_modules/fast-defer/src/index.ts')
54+
}
5055
},
5156

5257
// Keep previous output file structure
53-
outputOptions: {
54-
file: path.join(overrides.outDir ?? '', 'index.bundle.js')
58+
outputOptions: (options) => {
59+
const { dir, ...rest } = options;
60+
return {
61+
...rest,
62+
file: path.join(overrides.outDir ?? '', 'index.bundle.js')
63+
};
5564
}
5665
}
5766
}

0 commit comments

Comments
 (0)