EEParker / aspnetcore-vueclimiddleware

Helpers for building single-page applications on ASP.NET MVC Core using Vue Cli or Quasar Cli.
Other
339 stars 65 forks source link

UseSpaStaticFiles() from embedded resources #77

Closed maurodx closed 3 years ago

maurodx commented 3 years ago

Is it possible to configure asp.net core to serve all files needed for SPA from the resources embedded in the assembly? I need to produce a single file application and we can't distribute any other files/directory apart application executable file.

TobbenTM commented 3 years ago

So this Vue CLI Middleware actually only handles the case where you want to proxy stuff to the Vue CLI server while developing, which I guess you will still use?

And then when packaging, you'd serve the built static files?

I do believe you should be able to mark your SPA dist folder as embedded resources, and then pass a StaticFileOptions to the .UseSpaStaticFiles() call where you set the FileProvider to be a new EmbeddedResourceProvider. Let me know if this helps you along!

maurodx commented 3 years ago

@TobbenTM you are right! Using Microsoft.Extensions.FileProviders.Embedded package i'm able to load SPA static files from assembly.