diff --git a/packages/angular/build/src/tools/vite/utils.ts b/packages/angular/build/src/tools/vite/utils.ts index 7aa37482bf81..83085d910f60 100644 --- a/packages/angular/build/src/tools/vite/utils.ts +++ b/packages/angular/build/src/tools/vite/utils.ts @@ -69,26 +69,6 @@ export function getDepOptimizationConfig({ thirdPartySourcemaps: boolean; }): DepOptimizationConfig { const plugins: ViteEsBuildPlugin[] = [ - { - name: 'angular-browser-node-built-in', - setup(build) { - // This namespace is configured by vite. - // @see: https://github.com/vitejs/vite/blob/a1dd396da856401a12c921d0cd2c4e97cb63f1b5/packages/vite/src/node/optimizer/esbuildDepPlugin.ts#L109 - build.onLoad({ filter: /.*/, namespace: 'browser-external' }, (args) => { - if (!isBuiltin(args.path)) { - return; - } - - return { - errors: [ - { - text: `The package "${args.path}" wasn't found on the file system but is built into node.`, - }, - ], - }; - }); - }, - }, { name: `angular-vite-optimize-deps${ssr ? '-ssr' : ''}${ thirdPartySourcemaps ? '-vendor-sourcemap' : '' diff --git a/tests/legacy-cli/e2e/tests/vite/browser-node-module-dep-error.ts b/tests/legacy-cli/e2e/tests/vite/browser-node-module-dep-error.ts deleted file mode 100644 index 7d2f45198c7c..000000000000 --- a/tests/legacy-cli/e2e/tests/vite/browser-node-module-dep-error.ts +++ /dev/null @@ -1,26 +0,0 @@ -import assert from 'node:assert'; -import { execAndWaitForOutputToMatch, ng } from '../../utils/process'; -import { writeFile } from '../../utils/fs'; -import { getGlobalVariable } from '../../utils/env'; - -export default async function () { - assert( - getGlobalVariable('argv')['esbuild'], - 'This test should not be called in the Webpack suite.', - ); - - await ng('cache', 'clean'); - await ng('cache', 'on'); - - await writeFile('src/main.ts', `import '@angular-devkit/core/node';`); - - const { stderr } = await execAndWaitForOutputToMatch('ng', ['serve'], /ERROR.+node:path/, { - CI: '0', - NO_COLOR: 'true', - }); - - assert.match( - stderr, - /The package "node:path" wasn't found on the file system but is built into node/, - ); -}