thlorenz / brace

📔 browserify compatible version of the ace editor.
http://thlorenz.github.io/brace/
MIT License
1.06k stars 304 forks source link

Difficulties while creating a worker for a custom mode #147

Open n1313 opened 5 years ago

n1313 commented 5 years ago

Hi, I am trying to create a worker for a custom mode (following this guide) and I can't get my browser to make a request for my worker file. Upon examination of brace source, I have found a line in $workerBlob method that looks suspicious to me: https://github.com/thlorenz/brace/blame/master/index.js#L17977:

var script = mod.src;"importScripts('" + net.qualifyURL(workerUrl) + "');";

What is this string "importScripts('" + net.qualifyURL(workerUrl) + "');" supposed to be doing? This line was changed in v0.11.0. Before the change, it was this:

var script = "importScripts('" + net.qualifyURL(workerUrl) + "');";

This one makes more sense to me.

I am not entirely sure if this is a bug, or my problems are stemming from something else entirely, but I would appreciate someone more knowledgeable taking a look at this and helping me understand. And any pointers or docs on how to create a custom worker would be appreciated as well. Thanks!

wdick commented 5 years ago

Having the same problem. I'm trying to import my own mode generated with XText. But neither relative nor absolute URLs to the mode file are loaded.