How to disable a component during the build?

0 like 0 dislike
6 views
You do not want to bear the component completely, and in the nearest build it is not needed. There are options for how it can be disabled to angular cli didn't turn it on?
by | 6 views

2 Answers

0 like 0 dislike
Src/environments are environment.ts environment.prod.ts. In dev mode using the first, the prod - the second. And by default there is at least one field - production: true/false.

Accordingly, in your module file, write something like this:
let declarations = [SomeComponent]; if (!environment.production) { const devDeclarations = [/*your dev components*/]; declarations = declarations.concat(devDeclarations); // equivalent to [...declarations, ...devDeclarations] } @NgModule({ declarations, /*...*/ }) export class SomeModuleClass {}
by
0 like 0 dislike
It is not clear what is not included. Not declare. Or vospolzueshsya environments and do background checks. If prod then . . .
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Jun 9, 2019 by iammaddison143
0 like 0 dislike
1 answer
asked May 22, 2019 by azovl
110,608 questions
257,186 answers
0 comments
33,932 users