I'm working on an emberjs application that uses several other custom ember addons, in one of which we're adding a new dependency on mathjs (https://mathjs.org/) to do some expression parsing. It isn't clear though what the correct way to keep the configuration of that dependency on mathjs within only the addon that uses it is. Is there a "right" way to do this in ember?
What we ended up doing was just installing the mathjs package into our main app's node_modules, then exposing the library in the browser by doing an app.import('node_modules/mathjs/dist/math.min.js')
in our ember-cli-build.js file. This is obviously non-ideal because it means that any app using the custom addon must also do this extra setup to expose this dependency of the addon.
FWIW, we initially tried to just install the mathjs dependency into the addon's node_modules, then we imported it in the component of the addon where it's used. But then the browser said that the mathjs module couldn't be imported from the addon.
Aucun commentaire:
Enregistrer un commentaire