|
1 | | -import type { |
2 | | - GetManualChunk, |
3 | | - GetModuleInfo, |
4 | | - // ManualChunkMeta, |
5 | | - // OutputOptions, |
6 | | -} from 'rollup' |
7 | | -import { /* arraify, */ isInNodeModules } from '../utils' |
| 1 | +import type {} from // GetManualChunk, |
| 2 | +// GetModuleInfo, |
| 3 | +// ManualChunkMeta, |
| 4 | +// OutputOptions, |
| 5 | +'rolldown' |
| 6 | +// import { arraify, isInNodeModules } from '../utils' |
8 | 7 | // import type { UserConfig } from '../../node' |
9 | 8 | import type { Plugin } from '../plugin' |
10 | 9 |
|
@@ -43,55 +42,56 @@ export class SplitVendorChunkCache { |
43 | 42 | * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration |
44 | 43 | */ |
45 | 44 | export function splitVendorChunk( |
46 | | - options: { cache?: SplitVendorChunkCache } = {}, |
47 | | -): GetManualChunk { |
48 | | - const cache = options.cache ?? new SplitVendorChunkCache() |
49 | | - return (id, { getModuleInfo }) => { |
50 | | - if ( |
51 | | - isInNodeModules(id) && |
52 | | - !isCSSRequest(id) && |
53 | | - staticImportedByEntry(id, getModuleInfo, cache.cache) |
54 | | - ) { |
55 | | - return 'vendor' |
56 | | - } |
57 | | - } |
| 45 | + _options: { cache?: SplitVendorChunkCache } = {}, |
| 46 | +): () => null /* : GetManualChunk */ { |
| 47 | + // const cache = options.cache ?? new SplitVendorChunkCache() |
| 48 | + // return (id, { getModuleInfo }) => { |
| 49 | + // if ( |
| 50 | + // isInNodeModules(id) && |
| 51 | + // !isCSSRequest(id) && |
| 52 | + // staticImportedByEntry(id, getModuleInfo, cache.cache) |
| 53 | + // ) { |
| 54 | + // return 'vendor' |
| 55 | + // } |
| 56 | + // } |
| 57 | + return () => null |
58 | 58 | } |
59 | 59 |
|
60 | | -function staticImportedByEntry( |
61 | | - id: string, |
62 | | - getModuleInfo: GetModuleInfo, |
63 | | - cache: Map<string, boolean>, |
64 | | - importStack: string[] = [], |
65 | | -): boolean { |
66 | | - if (cache.has(id)) { |
67 | | - return cache.get(id) as boolean |
68 | | - } |
69 | | - if (importStack.includes(id)) { |
70 | | - // circular deps! |
71 | | - cache.set(id, false) |
72 | | - return false |
73 | | - } |
74 | | - const mod = getModuleInfo(id) |
75 | | - if (!mod) { |
76 | | - cache.set(id, false) |
77 | | - return false |
78 | | - } |
| 60 | +// function staticImportedByEntry( |
| 61 | +// id: string, |
| 62 | +// getModuleInfo: GetModuleInfo, |
| 63 | +// cache: Map<string, boolean>, |
| 64 | +// importStack: string[] = [], |
| 65 | +// ): boolean { |
| 66 | +// if (cache.has(id)) { |
| 67 | +// return cache.get(id) as boolean |
| 68 | +// } |
| 69 | +// if (importStack.includes(id)) { |
| 70 | +// // circular deps! |
| 71 | +// cache.set(id, false) |
| 72 | +// return false |
| 73 | +// } |
| 74 | +// const mod = getModuleInfo(id) |
| 75 | +// if (!mod) { |
| 76 | +// cache.set(id, false) |
| 77 | +// return false |
| 78 | +// } |
79 | 79 |
|
80 | | - if (mod.isEntry) { |
81 | | - cache.set(id, true) |
82 | | - return true |
83 | | - } |
84 | | - const someImporterIs = mod.importers.some((importer) => |
85 | | - staticImportedByEntry( |
86 | | - importer, |
87 | | - getModuleInfo, |
88 | | - cache, |
89 | | - importStack.concat(id), |
90 | | - ), |
91 | | - ) |
92 | | - cache.set(id, someImporterIs) |
93 | | - return someImporterIs |
94 | | -} |
| 80 | +// if (mod.isEntry) { |
| 81 | +// cache.set(id, true) |
| 82 | +// return true |
| 83 | +// } |
| 84 | +// const someImporterIs = mod.importers.some((importer) => |
| 85 | +// staticImportedByEntry( |
| 86 | +// importer, |
| 87 | +// getModuleInfo, |
| 88 | +// cache, |
| 89 | +// importStack.concat(id), |
| 90 | +// ), |
| 91 | +// ) |
| 92 | +// cache.set(id, someImporterIs) |
| 93 | +// return someImporterIs |
| 94 | +// } |
95 | 95 |
|
96 | 96 | /** |
97 | 97 | * @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration |
|
0 commit comments