borisirota / webworkify-webpack

launch a web worker at runtime that can require() in the browser with webpack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

String matching for functions.

KGan opened this issue · comments

7996812

string matching here won't work if the worker file defines its export function without a space, since the toString will always inject a space. Will happen very often with code minifiers.
(function(e){}).toString() // produces "function (e){}"

A quick fix will be to name the anonymous function (and make sure there is no white space between the name and the parenthesis => (function a (e){}).toString() // produces "function a(e){}"). It doesn't seem like I can do here something. Any ideas ?

I added this to the caveats section in the README so I'm closing it unless there will be some idea.

Thanks !

@KGan Should be fixed in version 1.1.1 with #11