| 88 | } |
| 89 | |
| 90 | function optimizeAliasReplacementForSSR( |
| 91 | id: string, |
| 92 | optimizeDeps: DepOptimizationOptions, |
| 93 | ) { |
| 94 | if (optimizeDeps.include?.includes(id)) { |
| 95 | return true |
| 96 | } |
| 97 | // In the regular resolution, the default for non-external modules is to |
| 98 | // be optimized if they are CJS. Here, we don't have the package id but |
| 99 | // only the replacement file path. We could find the package.json from |
| 100 | // the id and respect the same default in the future. |
| 101 | // Default to not optimize an aliased replacement for now, forcing the |
| 102 | // user to explicitly add it to the ssr.optimizeDeps.include list. |
| 103 | return false |
| 104 | } |
| 105 | |
| 106 | // In sync with rollup plugin alias logic |
| 107 | function matches(pattern: string | RegExp, importee: string) { |