I am building an add-on that has multiple .js files that are associated with it many of which need the access to the require() function but when i use the require function in them i get the error that require is not defined.used importScripts() to include the require.js file but the import scrips also generates error.
importScripts('resource://gre/modules/workers/require.js');
Also Used
self.importScripts('resource://gre/modules/workers/require.js');
The error generated is
JPM undefined Message: ReferenceError: importScripts is not defined
And
JPM undefined Message: ReferenceError: importScripts is not defined
Need help to include multiple files that can have the access to the require() or importScripts() function.
Looks like you're using the add-on SDK.
You can't use privileged code with all JS files, that includes require(). You can only use privileged code from your main.js script. Then use a content script/worker to communicate between the main script and the other script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With