Andre
Andre

Reputation: 181

Errors When Publishing in Angular 4 Project in Visual Studio Team Services

We have a project in Visual Studio Team Services that cannot be built and is having a problem being published. Here are the errors we are getting:

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's on line 8 of boot.server.ts:

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

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

I can get the project to publish locally on my computer.

I did a search and found other instances of this issue being solved by varying the parameters for the npm:

npm install [email protected]

However, I'm running 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 any.

Upvotes: 4

Views: 970

Answers (2)

Eranga Ananda
Eranga Ananda

Reputation: 53

Please check whether your components templateUrl path is correct.If the path is wrong then deployment give you an error like above. And make sure to remove include: /ClientApp/ from the webpack.config.js

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

Upvotes: 1

Slowbie
Slowbie

Reputation: 71

The vs2017 core 2.0 angular template has a line in the webpack.config.js file:

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

The include: /ClientApp/ prevents .ts files generated during publish or release build from being processed by Webpack.

If you remove the include: /ClientApp/ from the webpack.config.js .ts rule test it should work.

Upvotes: 0

Related Questions