In Browserify, the -i or --ignore option is used to ignore specific files or modules during the bundling process. However, as of my knowledge cutoff date in September 2021, Browserify does not have a built-in option to ignore an entire folder directly using the -i flag.

To ignore a full folder, you can use a combination of Browserify's --ignore option and the glob pattern. Here's how you can achieve this:

  1. Install Dependencies: Ensure you have Browserify installed globally or as a local development dependency:

    npm install -g browserify

    Or, if you prefer a local installation:

    npm install browserify --save-dev
  2. Create a Glob Pattern: Use a glob pattern to match all the files within the folder you want to ignore. For example, to ignore all files within the src/ignore-folder folder, you can use the following glob pattern:

  3. Bundle Your Code: Run the Browserify command, passing the --ignore option with the glob pattern:

    browserify entry.js -o output.js --ignore 'src/ignore-folder/*'

    Replace entry.js with the path to your entry file and output.js with the desired output file.

By specifying the --ignore 'src/ignore-folder/*' option, Browserify will exclude all files within the src/ignore-folder directory from the bundle.

Please note that the glob pattern should be enclosed in single quotes to prevent shell globbing before it reaches Browserify.

Keep in mind that Browserify is a dynamic and evolving tool, and new options or changes might have been introduced after my knowledge cutoff date. For the latest information and updates, I recommend checking the official documentation for Browserify or the relevant GitHub repository.

Have questions or queries?
Get in Touch