Skip to content
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

@nrwl/node generatePackageJson generated package.json should include tslib as dependency #9127

Closed
joeflateau opened this issue Feb 25, 2022 · 11 comments

Comments

@joeflateau
Copy link
Contributor

joeflateau commented Feb 25, 2022

Current Behavior

generating a @nrwl/node:app generates a typescript project, add generatePackageJson to the project.json and build will then create a package.json, however you cannot actually run the built app because tslib is required and not included as a dependency.

Expected Behavior

package.json should included all dependencies, including tslib

Steps to Reproduce

This issue may not be prioritized if details are not provided to help us reproduce the issue.

Failure Logs

Environment

Node : 16.13.0
OS : darwin arm64
npm : 8.1.4

nx : 13.7.1
@nrwl/angular : undefined
@nrwl/cli : 13.7.1
@nrwl/cypress : 13.7.1
@nrwl/detox : undefined
@nrwl/devkit : 13.7.1
@nrwl/eslint-plugin-nx : 13.7.1
@nrwl/express : 13.8.3
@nrwl/jest : 13.7.1
@nrwl/js : 13.7.1
@nrwl/linter : 13.7.1
@nrwl/nest : undefined
@nrwl/next : undefined
@nrwl/node : 13.8.3
@nrwl/nx-cloud : undefined
@nrwl/react : 13.7.1
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/storybook : 13.7.1
@nrwl/tao : 13.7.1
@nrwl/web : 13.7.1
@nrwl/workspace : 13.7.1
typescript : 4.5.5
rxjs : 6.6.7

Community plugins:
@otterdev/nx-cdk: 0.0.11
@otterdev/nx-cdk: 0.0.11

@wizardnet972
Copy link
Contributor

@joeflateau try to add tslib in your dependencies section in package.json . You might find it in devDependencies.

@joeflateau
Copy link
Contributor Author

@wizardnet972 the tslib dependency is in the root-level package.json but NOT in the package built when I run nx build my-express-server-project.

I've since added apps/my-express-server-project/package.json of

{
  "dependencies": {
    "tslib": "*"
  }
}

with that, dist/apps/my-express-server-project/package.json does include the tslib dependency

{
  "dependencies": {
    "tslib": "^2.0.0",
    "express-promise-router": "^4.1.1",
    "express": "4.17.2",
    "cors": "^2.8.5",
    "morgan": "^1.10.0"
  },
  "main": "main.js"
}

but I feel like if TS is the default that Nx should know to include tslib already (so I call this a bug)

@galah92
Copy link

galah92 commented Jul 1, 2022

Same problem, I think it's a bug. TSlib should always be included.

@jkossis
Copy link

jkossis commented Aug 11, 2022

Looks like the same issue was raised for @nrwl/js here, with a corresponding PR. I posted in the issue, gauging the feasibility/transfer-ability of what was done there.

@jkossis
Copy link

jkossis commented Aug 11, 2022

@AgentEnder your thoughts on that solution being ported over?

@AgentEnder
Copy link
Member

I think that this has already been ported 🤔 let me double check the code.

@jkossis
Copy link

jkossis commented Aug 11, 2022

@AgentEnder for some context, I am on "@nrwl/node": "14.5.4",, using the webpack executor.

@AgentEnder
Copy link
Member

Yeah, this should be covered by: https://github.com/nrwl/nx/blob/master/packages/node/src/utils/generate-package-json-webpack-plugin.ts#L33-L59

Can you retry with latest?

@AgentEnder AgentEnder added the blocked: retry with latest Retry with latest release or head. label Aug 11, 2022
@jkossis
Copy link

jkossis commented Aug 11, 2022

@AgentEnder ran nx migrate latest, though it didn't yield anything new.

Checking out that code you linked, it looks like it was merged 3 hours ago ... safe to assume it hasn't been released yet?

@AgentEnder
Copy link
Member

Ah, yes. My bad... It should be included in the next release.

I'm going to close this, since it should have been linked to that PR.

Fixed by #11419

@AgentEnder AgentEnder removed the blocked: retry with latest Retry with latest release or head. label Aug 11, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants