metalsmith-browserify1.1.0 • Public • Published
$ npm install metalsmith-browserify
- entries: required. The entry points that need to be browserified. Accepts an array of strings.
- browserifyOptions: optional. These options will be passed on to browserify. See this area of the browserify documentation for all available options. Note that it's possible to break stuff here, like overriding the entries or basedir, so use wisely.
- suppressNotFoundError: optional. By default
metalsmith-browserifywill exit with an error if a file can't be found. Enabling this option will suppress that error.
The entry points that should be browserified. So this
Would browserify both
./src/another.js and output them as
Note that if the entry path is nested, the paths may differ across operating systems. Make sure you're using the correct directory separators, or use node's path.join to make sure the path will work anywhere.
Use this to pass options to browserify. So this
Would enable browserify's debug option and add a source map to the bundle.
metalsmith-browserify exits with an error if it can’t find an entry file. If you’re doing any kind of incremental builds via something like
metalsmith-watch, this is problematic as you’re likely only rebuilding files that have changed. This flag allows you to suppress that error:
Note that when this option is turned on, if you're logging debug messages, you’ll still see a message denoting which files metalsmith-browserify cannot find.
Errors and debugging
If you're encountering problems you can use debug to enable verbose logging. To enable
debug prefix your build command with
DEBUG=metalsmith-browserify. So if you normally run
metalsmith to build, use
DEBUG=metalsmith-browserify metalsmith (on windows the syntax is slightly different).