/
githubmirror
/
angular-cli
Обзор
Документация
Войти
/
githubmirror
/
angular-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/angular_devkit/build_angular/src/utils/normalize-polyfills.ts
28 строк
737 B
Joey Perrott
refactor: move builtin module imports to use node: prefix imports
14 фев 2025, 22:09
14 фев 2025, 22:09
33ed6e8
Код
Авторство
О чём код?
/** * @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 { existsSync } from 'node:fs'; import { resolve } from 'node:path'; export function normalizePolyfills( polyfills: string[] | string | undefined, root: string, ): string[] { if (!polyfills) { return []; } const polyfillsList = Array.isArray(polyfills) ? polyfills : [polyfills]; return polyfillsList.map((p) => { const resolvedPath = resolve(root, p); // If file doesn't exist, let the bundle resolve it using node module resolution. return existsSync(resolvedPath) ? resolvedPath : p; }); }