-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
generatePackageJson adds @angular/{common/core} to Node project #4939
Comments
@the-ult it would be really helpful if you can share a repro repo. Can you also check if your issue is solved using |
Hi, sharing the repo would be difficult. But I wil try the |
The beta still seems to include the
However.
import { GraphQLEnvironment } from '@ddb/shared/environment';
export const environment: GraphQLEnvironment = {
..
} The /// This module is NOT imported in the ddb-graphql-server
import { ModuleWithProviders, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ClientEnvironment } from './environment.model';
import { ENV } from './environment.token';
@NgModule({
imports: [CommonModule],
})
export class EnvironmentModule {
static forRoot(environment: Partial<ClientEnvironment>): ModuleWithProviders<EnvironmentModule> {
return {
ngModule: EnvironmentModule,
providers: [{ provide: ENV, useValue: environment }],
};
}
} --
export const environment = {
...
} I figured, since we are only importing the |
@the-ult Thanks for trying it out and debugging this 👍 This sounds like an issue with our project graph calculation 🤔 tbh, I am not super familiar with that part of the code but if you can create a a minimal repro I can investigate it. |
Thanks. |
Hi @bekos
the shared-environment is an angular-lib. the
|
@bekos have you had any chance to try the sample repo? |
@the-ult I took a look, and based on the current implementation, I'm afraid there is no workaround, as Nx calculates dependencies based on the relation of the files and not on the actual imports. An alternative suggestion is to use something like |
Thanks for looking into it |
Closing as it is not actionable atm, imo the best approach in these cases is to generate (even manually) the appropriate |
Ok.. found out what caused the problem. We were using/importing an import { GraphQLEnvironment } from '@ddb/shared/environment';
export const environment: GraphQLEnvironment = {
...
} However.. The // shared/environment/src/index.ts
export * from './lib/shared-environment.module';
export * from './lib/environment-versions';
export * from './lib/environment.model';
export { DdbEnvironmentService } from './lib/environment.service'; I was in the (wrong) assumption that only actually used/imported files would be used. But it seems when you import 1 item from the package.. Alle files/dependencies of the Will this not be the case if we use (better) secondary-entrypoints / barrel files? related to: #6574 |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
We've got an Apollo/Express graphql-server and are using
"generatePackageJson": true,
to generate thepackage.json
for the production build of the graphql-server.The generated
package.json
adds@angular/common
and@angular/core
as dependencies, while it isn't an Angular project. And@angular/...
is not used in the project.Expected Behavior
The generated
package.json
should not include the@angular/..
dependenciesSteps to Reproduce
The generated package.json
angular.json
Environment
The text was updated successfully, but these errors were encountered: