Skip to content

Commit

Permalink
fix(@angular/build): resolve only ".wasm" files
Browse files Browse the repository at this point in the history
(cherry picked from commit 855a4b8)
  • Loading branch information
ms-dosx86 authored and dgp1130 committed Jul 17, 2024
1 parent 7cafee5 commit bdef398
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/angular/build/src/tools/esbuild/wasm-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function createWasmPlugin(options: WasmPluginOptions): Plugin {
return {
name: 'angular-wasm',
setup(build): void {
build.onResolve({ filter: /.wasm$/ }, async (args) => {
build.onResolve({ filter: /\.wasm$/ }, async (args) => {
// Skip if already resolving the WASM file to avoid infinite resolution
if (args.pluginData?.[WASM_RESOLVE_SYMBOL]) {
return;
Expand Down Expand Up @@ -94,7 +94,7 @@ export function createWasmPlugin(options: WasmPluginOptions): Plugin {
});

build.onLoad(
{ filter: /.wasm$/, namespace: WASM_INIT_NAMESPACE },
{ filter: /\.wasm$/, namespace: WASM_INIT_NAMESPACE },
createCachedLoad(cache, async (args) => {
// Ensure async mode is supported
if (!allowAsync) {
Expand Down Expand Up @@ -194,7 +194,7 @@ export function createWasmPlugin(options: WasmPluginOptions): Plugin {
}),
);

build.onLoad({ filter: /.wasm$/, namespace: WASM_CONTENTS_NAMESPACE }, async (args) => {
build.onLoad({ filter: /\.wasm$/, namespace: WASM_CONTENTS_NAMESPACE }, async (args) => {
const contents = args.pluginData.wasmContents ?? (await readFile(args.path));

let loader: 'binary' | 'file' = 'file';
Expand Down

0 comments on commit bdef398

Please sign in to comment.