vue-loader: Failed to mount component: template or render function not defined. (found in component
I’m making a Vue 2 component. But when I npm link it in other project and import it, I’m seeing this:
Failed to mount component: template or render function not defined. (found in component <input-tag>)
Here is my repo: https://github.com/matiastucci/vue-input-tag/tree/wtf and this is my webpack.prod.conf.js
Also, I saw some answers saying that I need a vue alias pointing to dist and I already have it.
I didn’t want to create an issue here but I’ve already posted in the Vue slack and forum and in SO but I still don’t know what’s going on. Maybe here someone can help me 😃
Thanks!
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 24 (11 by maintainers)
Hey, so I started looking into this. I think I found the reason that it breaks, but don’t know the solution yet.
So it has nothing to do with npm link, as was to be exüected.
withkeyword.Suspect 1: Webpack. Webpack 2 does add strict mode when you use
importinstead ofrequire()(which is according to ES-Modules’ spec, so no blame), but 1.) you used Webpack 1, and 2.) changing allimports torequire(including in my other test project to which I npm-link’ed your repo).Suspect 2: Babel. Babel’s
transform-es2015-modules-commonjsplugin, which is part of thees2015babel preset, adds strict mode. But according to its docs, we should be able to dectivate strict mode:But that didn’t work so far. Still digging, stay tuned.
Btw importing the .vue file directly works fine. So it’s something in the build chain that’s screwing up.
Btw the problem with
withis known and in the works: vuejs/vue#4115Sorry, haven’t had access to my dev machine this weekend, family affairs. Hope to get it done tomorrow evening.