cloudnc/observable-webworker

Ang11 + Webpack 5.... Module parse failed: ParserHelpers.addParsedVariableToModule is not a function

Closed this issue ยท 5 comments

Hello all,
I feel very alone with this problem... Am I the only one that tried to migrate to Angular 11 and cannot 'compile' anymore their worker...
I can't belive it.
I use : return fromWorker(() => new Worker('./myWorker.worker.ts',{type: 'module'}), input$
And it does not want to compile (Module parse failed: ParserHelpers.addParsedVariableToModule is not a function)

I read that the new syntax need a 'new URL(....' (GoogleChromeLabs/worker-plugin#88)
Compile, but the worker is not called properly from browser...

Help would be appreciated, I am on the 3thrd google page which is not a good sign... :/

Hi, as far as I'm aware webpack 5 is just in an experimental state for now and you have to opt in: angular/angular-cli#18820

I'd just suggest to stick to the default for now (webpack 4) and reconsider once webpack 5 becomes the default on the CLI.
Until then, you're likely to get issues like this one IMO

Thanks @maxime1992. Yep. It works fine with 4.
I wanted to get a head start... too much :)

Ah that's a shame webpack 5 doesn't yet support this pattern, though hopefully when it does it will make it possible to create webworkers for libraries in projects using NX ๐Ÿคž

I'll close this issue as it's not strictly an issue with this library, we're waiting on webpack.

This issue is now a reality, as Angular 12 is forcing the upgrade to Webpack 5. I've opened a new issue (see above.)

For anyone else in this issue, @lincolnthree and I worked out the kinks with getting this library working with Webpack 5 in #67. Please see the updated readme, in particular the Webpack 5 input section, and the @ObservableWebworker decorator deprecation notice