Reputation: 17783
I would like to ask what is the purpose of using browserify with noparse option set to true (or how browserify works). For instance:
var bundler = browserify();
bundler.add('jquery.js');
bundler.add('toastr.js');
bundler.bundle();
then I get the error, that jQuery module it not found.
Upvotes: 1
Views: 1631
Reputation: 26827
Normally when you bundle a file with browserify, it parses the file for require()
calls so it can build a dependency graph and bundle the required files. The purpose of the noParse
option is to skip that parsing when you don't need or want it. For example, if you're bundling a large library file like jQuery and you know it doesn't contain any require()
calls that need to be processed, it will save time in bundling if you noParse
that file. Also, it's currently difficult to require()
a previously browserified bundle when making a new bundle. In that case you can sometimes resolve the issue by setting noParse
for the previously browserified bundle.
if browserify does not parse files at all, does it means that it will not find require statements?
Yes.
Upvotes: 2