File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -56,18 +56,26 @@ export default function baseConfig(extendConfig = {}) {
5656 return {
5757 treeshake : false ,
5858 external ( rawId ) {
59+ // Order checks by likelihood for better performance.
60+ // Externalize Node.js built-ins (most common case).
61+ if ( isBuiltin ( rawId ) ) {
62+ return true
63+ }
5964 const id = normalizeId ( rawId )
65+ // Externalize TypeScript declaration files.
66+ if (
67+ id . endsWith ( '.d.ts' ) ||
68+ id . endsWith ( '.d.mts' ) ||
69+ id . endsWith ( '.d.cts' )
70+ ) {
71+ return true
72+ }
73+ // Externalize specific external packages.
6074 const pkgName = getPackageName (
6175 id ,
6276 path . isAbsolute ( id ) ? nmPath . length + 1 : 0 ,
6377 )
64- return (
65- id . endsWith ( '.d.cts' ) ||
66- id . endsWith ( '.d.mts' ) ||
67- id . endsWith ( '.d.ts' ) ||
68- EXTERNAL_PACKAGES . has ( pkgName ) ||
69- isBuiltin ( rawId )
70- )
78+ return EXTERNAL_PACKAGES . has ( pkgName )
7179 } ,
7280 onwarn ( warning , warn ) {
7381 // Suppress warnings.
You can’t perform that action at this time.
0 commit comments