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.

How to deal with optional dependencies ?

See original GitHub issue

I’m using Backbone & Backbone.native (as a jQuery replacement). But with browserify, I’m having an issue just here

try { $ = require('jquery'); } catch(e) {}

I don’t want jQuery, so for now I just use this really dirty workaround:

mkdir ./node_modules/jquery && ln -s ../backbone.native/backbone.native.js ./node_modules/jquery/index.js

Any idea how to handle that ?

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
goto-bus-stopcommented, Jun 1, 2018

@dy There is an --ignore-missing flag:

  --ignore-missing, --im            [default: false]

    Ignore `require()` statements that don't resolve to anything.
0reactions
dycommented, Jun 1, 2018

@goto-bus-stop as far as I get there is no way to set flags in “browserify” field, right? Is there any sense in transform, forwarding its flags to browserify?

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are Optional Dependencies and when should we use them
When a dependency is made optional, your program is still responsible for handling its absence. Step 3: Make a new file “app.js” and...
Read more >
Maven – Optional Dependencies and Dependency Exclusions
Optional dependencies are used when it's not possible (for whatever reason) to split a project into sub-modules. The idea is that some of...
Read more >
What Are NPM's Optional Dependencies and When Should ...
Execute npm install someDependency --save-optional to install a package as an optional dependency. · When you want to avoid installing optional ...
Read more >
Optional Dependency in Maven | Baeldung
As we're going to see we can include the <optional> element with a value of true to make any Maven dependency optional.
Read more >
java - Best strategy for dealing with optional dependencies
Best strategy for dealing with optional dependencies · Ease of use for end-users (minimum work required to use functionality if dependency is ...
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