How to properly implement WASM in angular
anonymousblackterminal opened this issue · 1 comments
anonymousblackterminal commented
Hi,
I'm trying to use this on an angular2 project; i have got it working but i think its using a js version as a fallback
is such a fallback present?
i have configured it by simply installing the npm package and importing argon2-bundled.min.js
in angular.json under projects.foo.architect.build.options.scripts:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"foo": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "sass"
},
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
.
.
.
"scripts": [
"node_modules/argon2-browser/dist/argon2-bundled.min.js",
]
}
then i simply call:
// @ts-ignore
argon2.hash({...})
i suspect it is not using WASM as it seems to be quite slow and doesn't make a call to .wasm as per network tab (i don't have the file hosted on the server anyway)
anonymousblackterminal commented
p.s. can confirm WASM is being used