ignore require() calls inside already browserified bundles#79
Open
goto-bus-stop wants to merge 2 commits intomasterfrom
Open
ignore require() calls inside already browserified bundles#79goto-bus-stop wants to merge 2 commits intomasterfrom
goto-bus-stop wants to merge 2 commits intomasterfrom
Conversation
This was referenced Feb 13, 2018
5592233 to
796bdae
Compare
This was referenced Feb 23, 2018
Member
Author
|
Will do this for browserify 17 if there are no complaints by then |
Member
|
What happens if someone has unbrowserified code that has a function argument named “require”? |
Member
Author
|
calls to that argument would not be collected as dependencies of the file. I considered that but thought that it would be very rare. But the check could be tightened further to check for the full |
Member
|
I think making it as strict as possible is a good idea, just in case. People may have even copy pasted browserify preambles into their code, and it’d be good to maximize what works. |
If a function expression declares a `require` parameter, its body is not analyzed for `require()` calls. This is mostly helpful for bundles that were already browserified, `detective` will ignore the calls to browser-pack's require runtime.
796bdae to
c9bfb24
Compare
|
Did this ever land? Asking for browserify/browserify#1817 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a function expression declares a
requireparameter, its body is notanalyzed for
require()calls. This is mostly helpful for bundles thatwere already browserified,
detectivewill ignore the calls tobrowser-pack's require runtime.
Doing full scope analysis using
scope-analyzerwould slow things down by at least about 30%; this patch however has no measurable performance hit and addresses the most common case of howrequiremight end up redefined.Fixes browserify/browserify#1773 (comment)