I'm learning VueJs and have followed a tutorial to produce a working app using the vue-cli WebPack template. All works fine; but I'm a bit OCD and hating that VS2017 doesn't format inline javascript in the vue file so:
- I move the javascript out from
users.vue
to a separate fileusers.js
so... - now VS2017 happily formats the js code, highlights bracket pairs etc and
- include as
<script src>
in the original vue.
Now when I npm run dev
I get:
[Vue warn]: Failed to mount component: template or render function not defined.
(found in <Users>)
vue.esm.js (559,1)
...and obviously the component doesn't load.
Have to be honest I'm at a bit of a loss where to start looking. Am I trying something I shouldn't in splitting out the js, or is there maybe something wrong with the default WebPack set up? I can't believe there's anything wrong splitting out the js as surely when I get beyond tutorials in to real world then reuse and separating from the component has to be possible?
On a side note is there a plugin to format inline javascript in Vue files on VS2017? I've got the VueJs 2017 and CodeMaid extensions but neither has helped formatting code.
I've created an example of the problem at https://github.com/9swampy/SplitVueJs