-
Notifications
You must be signed in to change notification settings - Fork 916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed error when vue module exports a function #137
Conversation
What's the use case of this? It's not a supported usage pattern. |
Dependency injection, especially when the dependency object is created by external code and cant be |
Just to make things clear - I mean the JS code inside .vue file. And the code that handles functions exported is already there, but does not work if module does not also export |
By design the |
I suppose you mean something like: Vue = require('vue')
module.exports = Vue.extend(...) but regardless of what the intention was - it still does not allow dependency injection. So what I am trying to do is to inject my dependencies when creating the component: parent.vue <script>
module.exports = {
components: require('child.vue')(dependencyReceivedFromTheEnvironment)
}
</script> child.vue: <script>
module.exports = function (dependency) {
return ....//component created using the dependency - like local jQuery, service object, etc.
}
</script> Even though it was not designed to work like this, it's was dead easy to fix the problem with my approach. |
What I am pointing out is - the toolchain around |
Well. How do I implemement dependency injection then? |
I'd like to know what makes dependency injection necessary when there is a module system. If it's for testing you can use |
Most staightforward one - when you need to build a redistributable On Fri, Jan 22, 2016 at 8:45 PM, Evan You [email protected] wrote:
|
eee6bdd does not fix this issue, as it creates a new empty object and effectively ignores the template exported by .vue file. |
This code would rise an error:
The deal is that
module.options
is not defined in this case, and there'smodule.options.template
usage in vue-loader.