question-mark
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.

specifying browserify options (plugins, extensions)

See original GitHub issue

ref #285, #262

currently you can only specify browserify transforms using the browserify.transform key in package.json. altlangs like typescript and coffeescript use custom (non-.js) extensions though which cannot be configured in package.json.

@yoshuawuyts & i chatted about this recently–adding some custom logic to bankai that reads additional configuration from the application’s package.json only (not from package.json in dependencies) could be a nice option:

// for typescript
{
  "browserify": {
    "plugin": [ "tsify" ]
  }
}
// for coffeescript
{
  "browserify": {
    "extensions": [ ".coffee" ],
    "transform": [ "coffeeify" ]
  }
}

this still leaves out plugins that need things like functions in their options, but you could work around that by wrapping it in a small plugin like so:

// package.json
{
  "browserify": {
    "plugin": [ "./browserifyConfig" ]
  }
}
// browserifyConfig.js
module.exports = function (b) {
  b.plugin('some-plugin', { option: function () {} })
}

anyone have more thoughts on this?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
s3ththompsoncommented, Dec 30, 2017

Just ran into this issue as well! Custom logic seems a bit hacky–is there any chance @substack would accept an upstream PR to add something like this to browserify core?

Alternately, perhaps we could carve out a typescript-specific solution? I feel like now that Choo has typescript support it would be great if Bankai supported it out-of-the-box too!

0reactions
yoshuawuytscommented, Jan 8, 2018

@goto-bus-stop yeah, that seems reasonable!

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to build modular applications with browserify - GitHub
setting the default extensions for .js and .json plus options configured in the opts.extensions parameter in the browserify constructor; configuring a global ...
Read more >
How to specify browserify extensions in package.json?
Yes I know it works like that - but I want browserify to use my package.json settings. I don't want to put "extensions"...
Read more >
Browserify
Browserify lets you require('modules') in the browser by bundling up all of your dependencies. Install Documentation · Source Code · Help + Articles...
Read more >
rollup.js
Run rollup --help to see the available options and parameters. ... As some plugins rely on file extensions to process files, you can...
Read more >
karma-browserify | Yarn - Package Manager
karma-browserify. owner nikku155.7kMIT8.1.0DT. A fast browserify integration for Karma that handles large projects with ease. karma-plugin ...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found