Errors when publishing to an Angular 4 project in Visual Studio Team Services

We have a project in Visual Studio Team Services that cannot be created and you have a problem with publishing. Here are the errors we get:

ERROR in ./ClientApp/boot.browser.ts (TaskId:55) 13:58:57.035     1>Module 
not found : error : Can't resolve 
./../$$_gendir/ClientApp/app/app.module.browser.ngfactory' in 
'd:\a\3\s\Axalta.ColorSelector\ClientApp' 
[d:\a\3\s\Axalta.ColorSelector\Axalta.ColorSelector.csproj]
@ ./ClientApp/boot.browser.ts 6:0-95 (TaskId:55)

ERROR in ./ClientApp/boot.server.ts (TaskId:55)
13:58:57.036     1>Module not found : error : Can't resolve 
'./../$$_gendir/ClientApp/app/app.module.server.ngfactory' in 
'd:\a\3\s\Axalta.ColorSelector\ClientApp' 
[d:\a\3\s\Axalta.ColorSelector\Axalta.ColorSelector.csproj]
@ ./ClientApp/boot.server.ts 8:0-94 (TaskId:55)

Here's what on line 8 of boot.server.ts:

import { AppModule } from './app/app.module.server';

The file app.module.server.ts physically exists, but app.module.server.ngfactory does not work.

I can publish the project locally on my computer.

I did a search and found that other instances of this problem are being solved by changing the settings for npm:

npm install enhanced-resolve@3.3.0

However, I run this from VSTS, which uses the following command to publish:

dotnet publish c:\<path> --configuration release --output c:\<path>

Does anyone have any ideas on how to solve this? I appreciate anyone.

+4
source share
2 answers

templateUrl. , , . include:/ClientApp/ webpack.config.js

@Component({
    selector: 'dynamic-form',
    templateUrl: './dynamic-form.component.html',
    providers: [DynamicControlService]
})
+1

vs2017 core 2.0 angular webpack.config.js:

{ test: /\.ts$/, include: /ClientApp/, use: isDevBuild ? ['awesome-typescript-loader?silent=true', 'angular2-template-loader'] : '@ngtools/webpack' },

include: /ClientApp/ .ts, , Webpack.

include: /ClientApp/ webpack.config.js.ts, .

0

Source: https://habr.com/ru/post/1685963/


All Articles