Is it possible to register wasm file like javascript?

227 views Asked by At

I have a javascript file that calls a wasm file, when I register the javascritpt somewhere in the script, it fetch the file from the wrong location. What's the best practice to solve this problem?

Here is what's going on:

$this->registerJsFile('@web/folder/file.js', ['position' => \app\components\View::POS_END]);

it suppose to get the wasm file from /folder/ but instead it grabbing it from /folder2/folder3/wasmfile.wasm

1

There are 1 answers

1
shukshin.ivan On

Looks like you forgot to convert common alias @web into a string. It is not done automatically in registerJsFile.

$this->registerJsFile(Yii::getAlias('@web/folder/file.js'), 
    ['position' => \app\components\View::POS_END]);

It is a known problem, you can see one rejected pull request here.