However, when I moved it to another react project and ran it, the following error occurred.
./src/features/stream-effects/virtual-background/vendor/tflite/tflite.js
Line 9: 'read' is not defined no-undef
Line 9: 'readbuffer' is not defined no-undef
Line 9: 'read' is not defined no-undef
Line 9: 'scriptArgs' is not defined no-undef
Line 9: 'quit' is not defined no-undef
Line 9: Unexpected use of 'print' no-restricted-globals
Line 9: Unexpected use of 'print' no-restricted-globals
Line 9: 'printErr' is not defined no-undef
Line 9: Unexpected use of 'print' no-restricted-globals
Line 9: Unexpected use of 'self' no-restricted-globals
Line 9: 'dateNow' is not defined no-undef
Line 18: 'define' is not defined no-undef
Line 19: Expected imports instead of AMD define() import/no-amd
Line 19: 'define' is not defined no-undef
[Questions]
The tflite.js file that has already been created generates the above error.
If I want to use the ‘already created tflite.js file’ in the jitsi open source in another project, do I need a separate setting?
If the already created tflite.js file does not work, should I use the wasm file directly?
(I was confused whether I should use the wasm file directly, I referred to the official document below, but this also gave me an error.)
If I want to use the tflite-simd.js file in another project, do I need to do ‘npm install’ additionally?
(ex: “@jitsi/rnnoise-wasm”, “@tensorflow/tfjs-backend-wasm”)
If I look at the package.json file, I will see something related to wasm.
I wasn’t sure if I should install these as well.
If I just copy the tflite-simd.js file, I get an error that the variable name cannot be found.
It expects to fetch that variable from outside.
However, I did not know where and how to get it, so I asked.
I looked at the git commit record of the source code, and it seems that only wasm-check was installed. (And I had that file installed in my project as well.)
If so, I don’t think it’s a problem with npm install, but I don’t know what options to add.
We vendor those dependencies, there is no npm package for it. As I said, you need both the JS and the WASM files. The JS files just make calls into the WASM loaded one.
Thank you for answer.
I checked the README.md file on github you mentioned.
There it was written to do ‘yarn build:tflite’ through docker to use the wasm file.
I couldn’t understand what the ‘tflite.js, tflite-simd.js’ files included in the link above were.
So I looked for 3 different ways to use wasm files.
But I don’t know if this way is correct.
At first, I reasoned that the ‘tflite.js’ file with the error would only work in jitsi’s react project.
So, I thought it wouldn’t work in a new react project.
However, through the contents of the link below, I thought that I might be wrong.
↑ However, I tried to unzip the ‘tflite.wasm’ file as per the above document, but it didn’t work.
(I typed “tar -xvf tflite.wasm” on my MacBook)
The ‘tflite.js’ file is not a file created in a specific React project.
=> That is, the wasm file itself was built.
If so, there is a high probability that there will be no problem using the ‘tflite.js, tflite-simd.js’ files provided by jitsi in my new project.
=> But I don’t know if my reasoning is correct.
I am checking if the reason why the tflite.js file is not working is because the react version of my project is low. However, as soon as I up the react version of my project, a lot of errors are occurring. I think I need to solve this problem first to check if my reasoning is correct.