aspnetcore-vuetify-universal icon indicating copy to clipboard operation
aspnetcore-vuetify-universal copied to clipboard

Cannot run the repo prerendering issues

Open maciz84 opened this issue 6 years ago • 4 comments

Hi dude,

I am keen to see what you have done but I cannot run the application VS2017 because of the pre-rendering. Could you please tell me how I can fix it:

Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: window is not defined

Thanks for your help

maciz84 avatar Apr 24 '18 07:04 maciz84

Hi, I'm sorry that I just written a readme in Chinese. Now I telling the way to run this project right here:

  1. install node.js
  2. run npm install
  3. run dotnet run

You should ensure has been installed all the node packages.If there are any questions,please feel free to comment below.Thanks for your attention.

ElderJames avatar Apr 24 '18 08:04 ElderJames

@ElderJames thanks for that I have done all those things I also had to install uglifyjs-webpack-plugin but the error is to do with pre-rendering. I don't mind running the project without pre-rendering but I don't know how to do this?

maciz84 avatar Apr 24 '18 08:04 maciz84

error

maciz84 avatar Apr 24 '18 08:04 maciz84

Oh,I'm sorry,this project has been refactored only applies to the server-side prerending... But you also refer to anthor project iview-aspnetcore to learn how to integrate a single page app to asp.net core.

There is a tip: Just write a middleware which make all the routes fallback to the entrance index.html file. Like:

 app.Use(async (context, next) =>
 {
        await next();
        if (context.Response.StatusCode >= 400)
        {
              context.Response.StatusCode = 200;
              await context.Response.SendFileAsync("wwwroot/index.html");
        }
 });

If you have any problems,please tell me! :)

ElderJames avatar Apr 24 '18 12:04 ElderJames