browserify / browserify

browser-side require() the node.js way
http://browserify.org/
MIT License
14.59k stars 1.19k forks source link

Using the new Function class in the output JS #2040

Open Acorn221 opened 2 years ago

Acorn221 commented 2 years ago

Hello everyone! I'm not too experienced with browserify, however I've recently been having a problem with the Chrome extensions manifest v3 which will take over manifest v2 in early 2023.

The problem is that browserify outputs the bundle with calls using the "new Function" class in javascript and that's no longer allowed with manifest v3. This could potentially mean that no one could use browserify when developing chrome extensions from what I can see.

nsfwJS uses browserify and that is used in a few chrome extensions to help remove or blur NSFW content, Here's the issue.

Could anyone help us out here? The goal would be to avoid using eval, new Function, or any other way of executing strings. Thanks!

ljharb commented 2 years ago

The problem is there’s a ton of functionality that requires syntax support, and the only way to have that and be compatible with older engines is to use Function (which, ftr, is completely safe, unlike direct eval).

It’s unfortunate that Chrome extensions are limiting this critical functionality; it indeed will mean that a lot of programs simply won’t work in that environment anymore.