问题
I have a questions in regards to the aspnetcore-spa functionality. What im trying to do is to implement it based on the sample project from yeoman (with angular2) in a SEPARATE project. But im running into an issue with i suspect is caused by some missing configuration or something. To explain what i do the following procedure illustrates the problem:
- I generated a sample project using 'yo aspnetcore-spa' and selected angular2.
- I created an empty .net core project.
- I copied over the, as i could see, relevant files into the new project from sample project. The result can be seen in: https://github.com/baseless/AspNetCoreSpaQDemo
The result
The generated sample project runs as expected. When looking in VS no .js files were generated based on the ts files in ClientApp. If i change a property in for example counter.ts file it is updated in browser as it should.
The created project with copied files however DO generate .js files during build. Webpack then seems to use these files so if i change property in counter.ts file, nothing is changed in browser. HOWEVER if i delete the matching counter.js file, the counter.ts file is rebuilt to js and browser updated.
What im having trouble finding is what causes this, since im just using the same project, webpack and so forth configuration files in both projects. I am totally green to webpack so perhaps something that need to be run? Are there something else that is needed for this to work?
回答1:
Did some examination of the sample project and it was caused by an xproj setting to disable automatic typescript compilation. Thought it had something to do with webpack but everything worked fine after i added <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
to my ProjectName.xproj file.
来源:https://stackoverflow.com/questions/38478251/aspnetcore-spa-webpack-when-used-in-separate-project-builds-unwanted-js-file