/
githubmirror
/
angular-cli
Обзор
Документация
Войти
/
githubmirror
/
angular-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/angular/build/src/tools/vite/plugins/ssr-transform-plugin.ts
36 строк
1 KB
Alan Agius
build: upgrade Vite to v8.0.16
22 июн 2026, 17:10
22 июн 2026, 17:10
b9681c0
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import remapping, { SourceMapInput } from '@ampproject/remapping'; import type * as Vite from 'vite' with { 'resolution-mode': 'import', }; export async function createAngularSsrTransformPlugin(workspaceRoot: string): Promise<Vite.Plugin> { const { normalizePath } = (await import('vite' as string)) as typeof Vite; return { name: 'vite:angular-ssr-transform', enforce: 'post', transform(code, _id, { ssr, inMap }: { ssr?: boolean; inMap?: SourceMapInput } = {}) { if (!ssr || !inMap) { return null; } const remappedMap = remapping([inMap], () => null); // Set the sourcemap root to the workspace root. This is needed since we set a virtual path as root. remappedMap.sourceRoot = normalizePath(workspaceRoot) + '/'; return { code, // eslint-disable-next-line @typescript-eslint/no-explicit-any map: remappedMap as any, }; }, }; }