Angular application builder - crypto-hash dependency
18:15 23 Feb 2026

I have a problem with one dependency after migration to application builder with SRR.

"build": {
      "builder": "@angular/build:application",
    ...
}

Crypto-hash when running development server with ssr it throws error like on image.

C:\Users\***\Desktop\my-angular-app>npm run serve:ssr:my-angular-app

> my-angular-app@0.0.0 serve:ssr:my-angular-app
> node dist/my-angular-app/server/server.mjs

unhandledRejection Error: Cannot find module 'C:\Users\***\Desktop\my-angular-app\dist\my-angular-app\server\thread.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1421:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1059:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1064:22)
    at Module._load (node:internal/modules/cjs/loader:1227:37)
    at TracingChannel.traceSync (node:diagnostics_channel:328:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:245:24)
    at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
    at MessagePort. (node:internal/main/worker_thread:223:26)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:845:20)
    at MessagePort. (node:internal/per_context/messageport:23:28) {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

After build there is also the same issue

Angular 21 SSR with crypto-hash dependency. Problem occurred also on older angular version

For reproduction

  • generate new angular application with ssr

  • install crypto-hash@4

  • use some function from library

Example

import { Component, signal } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { sha256 } from 'crypto-hash';

@Component({
  selector: 'app-root',
  imports: [RouterOutlet],
  templateUrl: './app.html',
  styleUrl: './app.css'
})
export class App {
  protected readonly title = signal('my-angular-app');

  async ngOnInit() {
    console.log(await sha256("sdadasda"))
  }
}
  • run application

I suspect that this can be easily done by coping file from node_modules, but in my opinion it shouldn't happened. But I don't know if this is problem with the crypto-hash itself or more with vite/angular and building process.

angular vite