-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ng add material in a library doesn't work #11438
Comments
add test in "test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.css"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
}, |
Hi @Gorniv it's a workaround or a final solution? |
workaround |
The error being produced:
Is not specific to the material schematics. I'm assuming this is a |
Having the same problem, but I couldn't get this workaround to work for me. Here is my original test config for my library module:
And this is what I tried to change it to, following the example posted above:
But when I try to run:
I still get the error:
|
If it helps, this is my build setting for the same project: |
I am also experiencing this issue. |
Seems ok by changing one apparently invalid key in
Eventually there's another "targets" reference in "YOUR-APP-NAME-e2e" too. |
@bldesign that did the trick thanks!!! |
@bldesign Amazing. Any thoughts why architect is not already in angular.json file ? |
The architect solution did the magic, thanks |
@bldesign Thanks a lot for the workaround. This should be implemented by angular by default. |
It seems to be in Github already: https://github.com/angular/angular/blob/master/aio/angular.json The current Angular-CLI 6.2.1 generates new projects with targets and not architect. The CLI v7.0.0-beta.2 too, no change (https://github.com/angular/angular-cli/releases/tag/v7.0.0-beta.2), for information. The following PR would solve it but it is blocked under |
@bldesign Yeah, you summed up everything. I will be working on supporting the new That way we can ensure that people that use CLI |
* Upgrades the devkit dependencies to the latest versions. * Adds support for the newly introduced and published `project.targets` instead of `project.architect` (see: angular/angular-cli@3071608) * Compatibility behavior for a published but non-announced breaking change within the schematic context (see: https://github.com/angular/angular-cli/commit/9720077a4b5ae628ddfaf5f1a26bac3b04bdf637#diff-e73df838d6700d187eff76a50c7e1c53R233`) Fixes angular#11438
* Upgrades the devkit dependencies to the latest versions. * Adds support for the newly introduced and published `project.targets` instead of `project.architect` (see: angular/angular-cli@3071608) * Compatibility behavior for a published but non-announced breaking change within the schematic context (see: https://github.com/angular/angular-cli/commit/9720077a4b5ae628ddfaf5f1a26bac3b04bdf637#diff-e73df838d6700d187eff76a50c7e1c53R233`) * Supports the new `project.targets` schema within the update schematics (in order to properly determine `tsconfig` files) Fixes angular#11438
* Upgrades the devkit dependencies to the latest versions. * Adds support for the newly introduced and published `project.targets` instead of `project.architect` (see: angular/angular-cli@3071608) * Compatibility behavior for a published but non-announced breaking change within the schematic context (see: https://github.com/angular/angular-cli/commit/9720077a4b5ae628ddfaf5f1a26bac3b04bdf637#diff-e73df838d6700d187eff76a50c7e1c53R233`) * Supports the new `project.targets` schema within the update schematics (in order to properly determine `tsconfig` files) Fixes angular#11438
* Upgrades the devkit dependencies to the latest versions. * Adds support for the newly introduced and published `project.targets` instead of `project.architect` (see: angular/angular-cli@3071608) * Compatibility behavior for a published but non-announced breaking change within the schematic context (see: https://github.com/angular/angular-cli/commit/9720077a4b5ae628ddfaf5f1a26bac3b04bdf637#diff-e73df838d6700d187eff76a50c7e1c53R233`) * Supports the new `project.targets` schema within the update schematics (in order to properly determine `tsconfig` files) * Due to the fact that the @angular-devkit/schematics now handles Bazel better, the template files will be resolved through NodeJS. This means that the template files need to be referenced in the @//:node_modules label. Fixes #11438
This worked for me! |
This comment from @bldesign worked for me. |
Didn't worked for me. Using angular cli 6.2.2. Still have an error |
@deepVova Please make sure you actually install
Otherwise the last stable version (which does not include the compatibility fixes) will be installed. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
BUG
What is the expected behavior?
Create material in a library
What is the current behavior?
Your project is not using the default configuration for build and test. The Angular Material schematics can only be used with the default configuration
What are the steps to reproduce?
ng new data-table
cd data-table/
ng generate library ngx-data-table
ng add @angular/material --project=ngx-data-table
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, material, platform-browser
... platform-browser-dynamic, router
Package Version
ng-packagr 3.0.0-rc.5
rxjs 6.1.0
typescript 2.7.2
webpack 4.8.3
Cc @amcdnl
The text was updated successfully, but these errors were encountered: