vue-formulate icon indicating copy to clipboard operation
vue-formulate copied to clipboard

Allow Vue Formulate to not require global components

Open jeff-hykin opened this issue 4 years ago • 2 comments

Feature: be able to use vue-formulate without calling Vue.use().

(Maybe there is a way, but I've tried my methods for temporailry hacking into Vue.component() to intercept the registration, and it didn't work possibly due to recursive components)

jeff-hykin avatar Mar 23 '21 20:03 jeff-hykin

why?

justin-schroeder avatar Mar 23 '21 20:03 justin-schroeder

The same reason we don't always use global variables; namespacing and name collisions.

If I want to make a package/component that depends on Vue Formulate, AFAIK I can't scope the formulate components to prevent global namespace pollution. So the user of my custom component/package imports "just my component" and thinks nothing of it. Then when they try to import a much-newer/much-older version of Vue Formulate, they're going to have a problem. Or if they create a chemistry app that balances the stoichiometric coefficients in their formulas and so they create a "formulate input" component and try register it globally only for my component to randomly break.

Similarly if two teams are working on a very large webapp, and they are using different versions of Vue Formulate, they will have a very bad time.

It is enough of a problem that this is something Vue 3 tries to fix (short article here).

jeff-hykin avatar Mar 25 '21 22:03 jeff-hykin