Just a few (hopefully useful) comments
Option 1 and 2
This approach is very simplistic and good for only very simple apps (and maybe codeproject demos). Why is it bad ?
- Vue.js code (template in this case) in server rendered Razor view. This is very bad idea for a few reasons, maintenance being most important for me. Its also hard to debug - you need to recompile and restart your Core app to see the result of your change (which make your SPA to reload and loose a state), there are no source maps, no hot reloading
- Vue template (which looks like HTML but in reality it's converted into JavaScript code generating Virtual DOM) is compiled at runtime instead of at build time. This not only makes your app 1st render take longer but also forces you to use Vue build with template compiler included thus increasing amount of Javascript browser needs to download and parse when loading the page
- Your VueJS (Javascript) code is not minimized, you don't use transpilation (Babel) or code splitting (Async Components) or Vue single file components
- Simply you don't have the power of Webpack and Vue CLI
Option 3
Is better in the way it is using npm/webpack/babel/eslint but it recommends creating your own configs. Main argument being
There is a tendency for JavaScript frameworks and libraries to rely on scaffolding tools for setup and configuration of an application. While this does get you up and running more quickly, it also alleviates you of understanding the settings and often leaves you with a bloated configuration.
This was valid argument back when there was only Vue CLI 2.x which generated your project from a template and after initial generation the burden to maintain the configuration (together with updating many npm packages used at build time) was solely on developer. Vue CLI 3.x changed that dramatically - it not only generates initial app but also manages all the tooling configuration for you.
One thing the article does right is keeping Vue app (SPA) separate from server (ASP.NET is here only to serve static files)
Recommendations
- Separate SPA and server - use Vue CLI for your SPA (just make subfolder in your Core app and generate there). Use Core just to implement API SPA will be using (and maybe some Error fallback route).
- For development you can setup VS to lunch both Core Dev server and CLI dev server and proxy API requests from your SPA to Core dev server. Inspiration here and here. That way you can change your API without restarting SPA and vice versa...
- I highly recommend using Visual Studio Code for your SPA development. Together with Vetur extension it provides far superior Vue development experience compared to full VS (and its free!)
- For production, its not hard to incorporate Vue CLI build command into Core project build process
To consider
Think about Server side rendering (SSR). It's deal breaker for many types of sites and its very hard without using Node as your server
the best way to do somethingin software. All approaches depend on your situation