@@ -31,6 +31,8 @@ This is a stand-alone module to add VueCli support to AspNet Core 2.2.0.
3131 public virtual void Configure (IApplicationBuilder app , IHostingEnvironment env )
3232 {
3333 // your config opts...
34+ // optional basepath
35+ // app.UsePathBase("/myapp");
3436
3537 // add static files from SPA (/dist)
3638 app .UseSpaStaticFiles ();
@@ -51,6 +53,54 @@ This is a stand-alone module to add VueCli support to AspNet Core 2.2.0.
5153 }
5254```
5355
56+ ## CSPROJ Configuration
57+ You may also need to add the following tasks to your csproj file. This are similar to what are found in the default ASPNETSPA templates.
58+
59+ ``` project.csproj
60+ <PropertyGroup >
61+ <!-- Typescript/Javascript Client Configuration -->
62+ <SpaRoot >ClientApp\</SpaRoot >
63+ <DefaultItemExcludes >$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes >
64+ </PropertyGroup >
65+ <Target Name =" DebugEnsureNodeEnv" BeforeTargets =" Build" >
66+ <!-- Build Target: Ensure Node.js is installed -->
67+ <Exec Command =" node --version" ContinueOnError =" true" >
68+ <Output TaskParameter =" ExitCode" PropertyName =" ErrorCode" />
69+ </Exec >
70+ <Error Condition =" '$(ErrorCode)' != '0'" Text =" Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
71+ </Target >
72+
73+ <Target Name =" DebugEnsureNpm" AfterTargets =" DebugEnsureNodeEnv" >
74+ <!-- Build Target: Ensure Node.js is installed -->
75+ <Exec Command =" npm --version" ContinueOnError =" true" >
76+ <Output TaskParameter =" ExitCode" PropertyName =" ErrorCode" />
77+ </Exec >
78+ </Target >
79+
80+ <Target Name =" EnsureNodeModulesInstalled" BeforeTargets =" Build" Inputs =" package.json" Outputs =" packages-lock.json" >
81+ <!-- Build Target: Restore NPM packages using npm -->
82+ <Message Importance =" high" Text =" Restoring dependencies using 'npm'. This may take several minutes..." />
83+
84+ <Exec WorkingDirectory =" $(SpaRoot)" Command =" npm install" />
85+ </Target >
86+
87+ <Target Name =" PublishRunWebpack" AfterTargets =" ComputeFilesToPublish" >
88+ <!-- Build Target: Run webpack dist build -->
89+ <Message Importance =" high" Text =" Running npm build..." />
90+ <Exec WorkingDirectory =" $(SpaRoot)" Command =" npm run build" />
91+
92+ <!-- Include the newly-built files in the publish output -->
93+ <ItemGroup >
94+ <DistFiles Include =" $(SpaRoot)dist\**" />
95+ <ResolvedFileToPublish Include =" @(DistFiles->'%(FullPath)')" Exclude =" @(ResolvedFileToPublish)" >
96+ <RelativePath >%(DistFiles.Identity)</RelativePath >
97+ <CopyToPublishDirectory >PreserveNewest</CopyToPublishDirectory >
98+ </ResolvedFileToPublish >
99+ </ItemGroup >
100+ </Target >
101+
102+ ```
103+
54104## History
55105
56106Due to the discussion [ here] ( https://github.com/aspnet/JavaScriptServices/pull/1726 ) , it was decided to not be included in the Microsoft owned package.
0 commit comments