Skip to content

Prod build fails with "Can't resolve '@angular/material/material' #6046

@SteveHWork

Description

@SteveHWork

Bug, feature request, or proposal:

Bug

What is the expected behavior?

ng build --prod should complete without errors.

What is the current behavior?

Prod build fails with:

ERROR in ./app/$$_gendir/app.module.ngfactory.ts
Module not found: Error: Can't resolve '@angular/material/material'
in 'C:\Code\app$$_gendir'
@ ./app/$$_gendir/app.module.ngfactory.ts 30:0-50
@ ./app/main.ts
@ multi ./app/main.ts

What are the steps to reproduce?

TestApp.zip

npm install
ng build --prod

What is the use-case or motivation for changing an existing behavior?

N/A

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

This works with angular v4.2.6 but fails with v4.3.0/v4.3.1

@angular/cli: 1.2.1
node: 7.1.0
os: win32 x64
@angular/animations: 4.3.1
@angular/cdk: 2.0.0-beta.8
@angular/common: 4.3.1
@angular/compiler: 4.3.1
@angular/core: 4.3.1
@angular/flex-layout: 2.0.0-rc.1
@angular/forms: 4.3.1
@angular/http: 4.3.1
@angular/material: 2.0.0-beta.8
@angular/platform-browser: 4.3.1
@angular/platform-browser-dynamic: 4.3.1
@angular/router: 4.3.1
@angular/upgrade: 4.3.1
@angular/cli: 1.2.1
@angular/compiler-cli: 4.3.1

Is there anything else we should know?

A non-prod build works fine.

This was reported initially against angular CLI, but I was asked to report it here.
angular/angular-cli#7062

A number of others are experiencing it as well.

There is no reference to "material/material" in the source of the app, so there must be something in the framework that is referencing this path.

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaround

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions