MCPcopy
hub / github.com/vitejs/vite / optimizeAliasReplacementForSSR

Function optimizeAliasReplacementForSSR

packages/vite/src/node/plugins/preAlias.ts:90–104  ·  view source on GitHub ↗
(
  id: string,
  optimizeDeps: DepOptimizationOptions,
)

Source from the content-addressed store, hash-verified

88}
89
90function 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
107function matches(pattern: string | RegExp, importee: string) {

Callers 1

resolveIdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected