Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WASM support regression when switching to the esbuild builder #26826

Closed
demurgos opened this issue Jan 9, 2024 · 5 comments
Closed

WASM support regression when switching to the esbuild builder #26826

demurgos opened this issue Jan 9, 2024 · 5 comments

Comments

@demurgos
Copy link
Contributor

demurgos commented Jan 9, 2024

Which @angular/* package(s) are the source of the bug?

compiler

Is this a regression?

Yes

Description

I am updating my project from "builder": "@angular-devkit/build-angular:browser" to "builder": "@angular-devkit/build-angular:application", since it's the recommended builder.

Unfortunately, I now get an error related to a WASM module in one of my dependencies. No Wasm support is a blocker for me to update.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

✘ [ERROR] No loader is configured for ".wasm" files: ../../../../../../home/demurgos/.yarn/berry/cache/@eternal-twin-marktwin-npm-0.5.0-dfc7fb40c3-10.zip/node_modules/@eternal-twin/marktwin/lib/wasm/index_bg.wasm

    ../../../../../../home/demurgos/.yarn/berry/cache/@eternal-twin-marktwin-npm-0.5.0-dfc7fb40c3-10.zip/node_modules/@eternal-twin/marktwin/lib/wasm/index.js:1:22:
      1 │ import * as wasm from "./index_bg.wasm";
        ╵                       ~~~~~~~~~~~~~~~~~

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.0.9
Node: 21.5.0 (Unsupported)
Package Manager: yarn 4.0.2-git.20240103.hash-c68c716
OS: linux x64

Angular: 17.0.8
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.9 (cli-only)
@angular-devkit/build-angular   17.0.9
@angular-devkit/core            17.0.9 (cli-only)
@angular-devkit/schematics      17.0.9 (cli-only)
@angular/cli                    17.0.9
@angular/ssr                    17.0.9
@schematics/angular             17.0.9 (cli-only)
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.2
    
Warning: The current version of Node (21.5.0) is not supported by Angular.

Anything else?

No response

@JoostK
Copy link
Member

JoostK commented Jan 9, 2024

Loading wasm using ES module imports is non-standard: https://developer.mozilla.org/en-US/docs/WebAssembly/Loading_and_running#what_are_the_options

Angular 17.1 (to be released) allows to specify a loader type for any extension, which should help make this work.

@JoostK JoostK transferred this issue from angular/angular Jan 9, 2024
@demurgos
Copy link
Contributor Author

demurgos commented Jan 9, 2024

Oh, wow thanks. I've been using Wasm for years and thought that it's been standardized for a while.

The ESM integration repo for Wasm is over 7 years old but not ready yet it seems. (currently at phase 2)

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jan 9, 2024

@alan-agius4 alan-agius4 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 9, 2024
@demurgos
Copy link
Contributor Author

demurgos commented Jan 9, 2024

For reference, the feature for loader types was implemented in #26371. It still requires to instantiate the module as described in the MDN link so it's I don't think there's a config yet to retrieve support as with Webpack.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants