Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

use browserify options from package.json if available

See original GitHub issue

On a project that already have browserify transforms in the browserify field of package.json, it would be cool to not have to type them all on the bankai start cli command as --js.transform… (And maybe to bankai build as well)

Expected behavior:

The command should be able to guess if the user have configured browserify on the package.json file and use those by default.

Ugly patch for start.js:

--- left
+++ right
@@ -55,6 +55,10 @@

   if (opts.js) {
+    try {
+      const pkgOpt = require(cwd + '/package.json').browserify;
+      opts.js = xtend(opts.js, pkgOpt);
+    } catch (e) {};
     const js = bankai.js(browserify, entryFile, opts.js)
     const route = opts.html.entry || '/bundle.js'
     routes.push([route, js])

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

fczuardicommented, Sep 4, 2016

Or some other way to tell bankai to inherit the config of browserify, like ava does for babel config:

"ava" {
  "babel": "inherit"
yoshuawuytscommented, Nov 6, 2016

I think this should work; if not passing { basedir: __dirname } or something to browserify (js:) in the constructor should probs resolve it - closing for now

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to specify browserify config in package.json ...
In case you haven't found an answer to this yet: Yes, it is and quite simple. You were very close. here's the example...
Read more >
how to build modular applications with browserify - GitHub
For each xyz directory that exists, node will first look for an xyz/package.json to see if a "main" field exists. The "main" field...
Read more >
Here is a tutorial on how to use Browserify on the command line to bundle up a simple file called main.js along with...
Read more >
Browserify - npm
Start using browserify in your project by running `npm i browserify`. ... the name given as a window global if no module system...
Read more >
Getting Started with Browserify - SitePoint
When using Browserify, it'll look through all of your JS files that are imported and will only import each module that is mentioned...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found