TrilonIO / aspnetcore-Vue-starter

*NEW* Asp.net Core & Vue.js (ES6) SPA Starter kit - Vuex, webpack, Web API, Docker, and more! By @TrilonIO
https://www.trilon.io
MIT License
1.22k stars 266 forks source link

Great start - DataFromController and HMR #8

Closed waynebrantley closed 7 years ago

waynebrantley commented 7 years ago

You controller returns DataFromController, but it is never used. Was interested in how you were going to make that happen.

There is another example of this at https://github.com/ligershark/CoreTemplatePack

waynebrantley commented 7 years ago

The one I linked is fairly complex to read and reason about due to all the plug-ins it uses. However, it does have hot module reloading and that is a great development benefit. It also creates output filenames for the scripts and such that are cache busting and this is a good feature.

Perhaps there is information to gather from that repo or you guys might merge. Yours integrates the SPA services to get server side rendering so that is a great feature too.

Anyway, good work, just my initial thoughts!

MarkPieszak commented 7 years ago

Hey @waynebrantley thank you :) I just took it public yesterday, there's definitely a few things I need to add in there, no doubt!

For example, vue-resource and server-side rendering don't work (as resource uses document,etc), so I'm going to be adding request and other vue & SSR capable alternatives so showcase making an XHR request to hit the Web API (that's why there's nothing accessing it yet).

This repo has HMR as well, is it not working for you?

waynebrantley commented 7 years ago

HMR? I looked through everything and did not see it. I did not try your repo, just reviewed it all.

waynebrantley commented 7 years ago

Crap...I keep hitting ctrl enter for a new line...(slack) Anyway, I can try the HMR, glad to hear you have it. We need a good solution....and I am not a webpack expert by any stretch! What about AXIOS for the ajax? Using the prototype of vue, we add to $http as suggested by vue creator and it works nicely.

It is a great start. Few questions:

I will clone your repo and give it an actual whirl. What are the npm run`' commands for doing everything? is itnpm run dev`` etc?

One day of live...didn't notice that...really nice start!

MarkPieszak commented 7 years ago

Thanks, I put it together last night fairly quickly :) Plenty more updates to come!

As for playing with initial (currently minimal) repo, just fork & clone, open in VSCode, and download those .NET Core dependencies (when the banner pops up), or manually do them in command line.

dotnet restore && yarn install && webpack

Then just hit F5 in VSCode, and it should start it up :)

waynebrantley commented 7 years ago

Thanks for the info. I am still in the full visual studio and non .net core application. We will attempt to move to asp.net core (targeting full framework) when the tooling is finally done so kind of in a holding pattern for a few months on that. Given that, I am a bit at a loss for how to have the iis express launch for my 'website' for testing, have the webpack server launch to handle the HMR and have the scripts point to that webpack server. Any pointers?

and going that entire route. This would also mean, you'd probably not be using webpack, so no HMR, and other "nifty" features.

Not sure why that would be the case...if I have a feature that is vuejs, I simply would need a webpack entry for that 'app' that generates the script. That would be hooked up no differently than the 'one big one' you hook up....I just might have 'several apps'. Same is true if it was just 'sprinkled' into a page...although when sprinkling that would more likely be some small inline vuejs. Mostly it is either redo the whole page or not. Then once there are multiple pages with vuejs you could combine those into a shared app - each opening the correct section based on routing....keep going..and one day you have everything! File|New is just not an option for us (and most teams I would think), so I think a progressive way to adopt is important. As an example, we have MVC and webforms in the same app at the same time inter operating with one another. Again, could not File|New....we are 3 webforms away from ditching that...(big YEAH).

Those are my thoughts...if I am way off...I am listening. :-)

MarkPieszak commented 7 years ago

In order to have HMR, you must be using webpack-dev-server, which in the case of this repo, is tied into .NET Core itself (you can see it in the Startup.cs file). So when the project starts, it's proxying those dev-server requets automatically for you into the same localhost. You can thank Steve for that magic :)

If you were using it within an existing .NET framework application, you'd have to spin up the webpack-dev-server simultaneously as your application starts, and the "bundle" file, wouldn't be located on the same localhost port, it'd be on the webpack-dev-server one. You'll run into a whole mess of difficulties & problems when doing all of that.

You'll want to just use regular Vue with es5, include the Githubissues.

  • Githubissues is a development platform for aggregating issues.