This repository was archived by the owner on Aug 7, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 40
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
[how-to] use workers with webpack #229
Copy link
Copy link
Closed
Description
I am trying to use a webworker within my project for background computation purposes.
here are my versions :
All NativeScript components versions information
┌──────────────────┬─────────────────┬────────────────┬─────────────┐
│ Component │ Current version │ Latest version │ Information │
│ nativescript │ 3.1.2 │ 3.1.2 │ Up to date │
│ tns-core-modules │ 3.1.0 │ 3.1.0 │ Up to date │
│ tns-android │ 3.1.1 │ 3.1.1 │ Up to date │
│ tns-ios │ 3.1.0 │ 3.1.0 │ Up to date │
When I was using {N} 2.5.5, I had a system built like that :
- My application was using a webpack-compiler wrapper made by triniwiz
- I made a variable,
globals.isAoT
that I used to set in mymain.ts
andmain.aot.ts
and checked in my worker instanciation - At instanciation, it looked like that :
try {
if(this.isAoT) {
let WW = require("worker-loader!./voronoi.worker.js");
this._mainWorker = new WW;
} else {
this._mainWorker = new Worker("./voronoi.worker.js");
}
} catch(error) {
console.log("VoronoiWorkerService::instanciateMainWorker() : ", error);
}
And is was working well.
With {N} 3.1.1, I dropped usage of the globals
variable, but all the rest is still the same but this is not working anymore.
The issue is :
Exception in thread "main" java.io.IOException: File already exists. This may lead to undesired behavior.
Please change the name of one of the extended classes.
File:/home/eric/my-project/platforms/android/src/main/java/com/tns/FragmentClass.java Class: com.tns.FragmentClass
at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:68)
at org.nativescript.staticbindinggenerator.Main.main(Main.java:15)
:asbg:generateBindings FAILED
My question then is, how am I supposed to use my webworker with {N} 3.1.1 webpacked ? Thanks a lot !
Metadata
Metadata
Assignees
Labels
No labels