Since 1.6.4 Angular Material CSS import does not work anymore (breaking change)
Versions
Angular CLI: 1.6.4
Node: 9.4.0
OS: linux x64
Angular: 5.2.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cdk: 5.0.4
@angular/cli: 1.6.4
@angular/material: 5.0.4
@angular-devkit/build-optimizer: 0.0.37
@angular-devkit/core: 0.0.24
@angular-devkit/schematics: 0.0.45
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.4
@schematics/angular: 0.1.12
typescript: 2.6.2
webpack: 3.10.0
Repro steps
A new Angular CLI and Angular Material project like mentioned here: https://material.angular.io/guide/getting-started
Observed behavior
The import @import "~@angular/material/prebuilt-themes/indigo-pink.css"; in the styles.css fails:
ERROR in ./node_modules/css-loader?{"sourceMap":false,"import":false}!./node_modules/postcss-loader/lib?{"ident":"postcss","sourceMap":false}!./src/styles.css
Module build failed: Error: Can't resolve '~@angular/material/prebuilt-themes/indigo-pink.css' in '/.../src'
at onError (/.../node_modules/enhanced-resolve/lib/Resolver.js:61:15)
at loggingCallbackWrapper (/.../node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at runAfter (/.../node_modules/enhanced-resolve/lib/Resolver.js:158:4)
at innerCallback (/.../node_modules/enhanced-resolve/lib/Resolver.js:146:3)
at loggingCallbackWrapper (/.../node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at next (/.../node_modules/tapable/lib/Tapable.js:252:11)
at /.../node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:40:4
at loggingCallbackWrapper (/.../node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at runAfter (/.../node_modules/enhanced-resolve/lib/Resolver.js:158:4)
at innerCallback (/.../node_modules/enhanced-resolve/lib/Resolver.js:146:3)
at loggingCallbackWrapper (/.../node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at next (/.../node_modules/tapable/lib/Tapable.js:252:11)
at innerCallback (/.../node_modules/enhanced-resolve/lib/Resolver.js:144:11)
at loggingCallbackWrapper (/.../node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at next (/.../node_modules/tapable/lib/Tapable.js:249:35)
at resolver.doResolve.createInnerCallback (/.../node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:44:6)
@ ./src/styles.css 4:14-138
@ multi ./src/styles.css
Desired behavior
No error or update Angular Material Getting started section.
Mention any other details that might be useful (optional)
Worked until 1.6.3 :)
@clydin Its still not working with ng build --prod with below config.
Hope you guys added an unit test for this feature.
This doesn't work:
@import 'https://fonts.googleapis.com/icon?family=Material+Icons';
This works:
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
devDependencies": { "@angular/cli": "^1.7.4", "@angular/compiler-cli": "^5.2.9", "@angular/language-service": "^5.2.0", "@types/jasmine": "~2.8.3", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", "codelyzer": "^4.0.1", "jasmine-core": "~2.8.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~2.0.0", "karma-chrome-launcher": "~2.2.0", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", "ts-node": "~4.1.0", "tslint": "~5.9.1", "typescript": "^2.6.2" }
Yes, there are tests for multiple forms in both global and component styles in all of the following: CSS, SCSS, LESS, and stylus.
Please open a new issue with a minimal reproduction so that the problem can be fully examined.
@clydin would't it be a duplicate?
Beyond ridiculous. If I have to spend another set of hours having to hunt down such stupid issues... a tilde that used to work... really? I'm just going to switch to a different framework it is getting impossible to work with.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.