Skip to content

Commit 1b4dced

Browse files
committed
fix(@angular/build): use sha256 instead of sha-256 as hash algorithm name
Stackblitz appears to fail when attempting to use `crypto.createHash` with an algorithm value of `sha-256`. Since Node.js supports both the hyphenated and unhyphenated values, the later is now used to avoid issues when running on Stackblitz. (cherry picked from commit 1ded0b7)
1 parent b63123f commit 1b4dced

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export function createCompilerPlugin(
198198
// invalid the output and force a full page reload for HMR cases. The containing file and order
199199
// of the style within the containing file is used.
200200
pluginOptions.externalRuntimeStyles
201-
? createHash('sha-256')
201+
? createHash('sha256')
202202
.update(containingFile)
203203
.update((order ?? 0).toString())
204204
.update(className ?? '')

packages/angular/build/src/tools/esbuild/wasm-plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ function generateInitHelper(streaming: boolean, wasmContents: Uint8Array) {
231231
let resultContents;
232232
if (streaming) {
233233
const fetchOptions = {
234-
integrity: 'sha256-' + createHash('sha-256').update(wasmContents).digest('base64'),
234+
integrity: 'sha256-' + createHash('sha256').update(wasmContents).digest('base64'),
235235
};
236236
const fetchContents = `fetch(new URL(wasmPath, import.meta.url), ${JSON.stringify(fetchOptions)})`;
237237
resultContents = `await WebAssembly.instantiateStreaming(${fetchContents}, imports)`;

0 commit comments

Comments
 (0)