0

In my project, I get an "Unknown event, two Bacons loaded?” error when using the Bacon.js library. I have Bacon.js as a dependency and also as a dependency of another package that my project depends on.

raimohanska
  • 3,265
  • 17
  • 28

1 Answers1

2

This occurs because Bacon.js uses some internal global mutable state and refuses to work if there are two Bacon.js libraries loaded at the same time.

You most likely have baconjs in two locations under node_modules because you have it as a direct dependency as well as a transitive dependency (dep of a dep).

When writing libraries that require Bacon.js it's advisable to declare it as a peerDependency and devDependency instead of a regular dependency, to avoid including two versions of the library.

raimohanska
  • 3,265
  • 17
  • 28