Open raz-sinay opened 4 years ago
Hey @raz-sinay! Sorry, but I don't have a good solution either…
You could try removing the new NodeTargetPlugin()
, as the threads-plugin should apply the NodeTargetPlugin automatically to the webpack child compiler that creates the worker bundle.
But yeah, I guess probably something's wrong with the loader configuration. Without seeing the actual TypeScript error it will be tough, though.
Is It fixed or we have to use only js for now?
I am not sure what the current status is, but we have always used threads.js with the threads-plugin with TypeScript and never saw that error. Might be specific to Electron, might be specific to that particular webpack config here, hard to tell without further details @raz-sinay
In general, you should expect the plugin to work with TypeScript 😉
Hi, I've encountered something strange when using the plugin when writing typescript workers. inside an electron environment and using
electron-webpack
andelectron-builder
for bundling and building.When I run the app in
dev
mode (yarn dev
), everything get's transpiled, bundled and running OK, but whenever trying to build the app into an executable, I get errors from typescript, failing the build.Last time it happened to me, the problem was really petty. When I defined my array as
const myArray: MyType[] = [];
, typescript failed to build. Eventually, only after changing the code to be:const myArray: Array<MyType> = new Array();
it worked.now I'm facing some another similar issue , that prevents me to do some kind of easy reduce code over an array.
my webpack is based upon electron-webpack's defaults, and I added this to allow node's built-in api inside workers:
I have tried both with and without
ts-node
installed, the result is the same.There are actually 2 errors listed, the one I've mentioned above. and this one:
I can't tell the actual typescript error, even if there is one, because it's not showing at the output. I'm afraid something in my configurations isn't defined properly. would love to get your advice. What am I missing?