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

@swc/helpers not included in package.json for nest apps with incr compiled libs #10270

Closed
yharaskrik opened this issue May 12, 2022 · 1 comment · Fixed by #10275 or #10297
Closed

@swc/helpers not included in package.json for nest apps with incr compiled libs #10270

yharaskrik opened this issue May 12, 2022 · 1 comment · Fixed by #10275 or #10297

Comments

@yharaskrik
Copy link
Contributor

Current Behavior

When bundling a Nest app with @nrwl/node:webpack where some of the apps libs are incrementally compiled with @nrwl/js:swc the @swc/helpers package is not included in the package.json with the --generatePackageJson flag.

I believe this is because the @swc/helpers lib is listed as a devDependency so webpack ignores it. The only way I could get it to work is to add @swc/helpers to dependencies and then doing import '@swc/helpers'; in my apps main.ts file. That made the package show up in the generated package json

Expected Behavior

If a library is used at runtime then it should be included in the package.json that is generated.

@swc/helpers should probably be listed in dependencies not devDependencies as it is a runtime dependency not a dev dependency.

We should also not need to import it into the main.ts for it to be included as the compiled libraries use it, it is even included in the incrementally compiled libraries package.jsons as a dependency.

Steps to Reproduce

  1. Generate workspace with Nest app
  2. Generate a buildable swc TS library
  3. import that library into nest app
  4. build app with --generatePackageJson
  5. @swc/helpers is not in the generated package.json

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

Failure Logs

Environment

Node : 14.19.0
   OS   : darwin x64
   yarn : 1.22.18
   
   nx : 14.1.4
   @nrwl/angular : 14.1.4
   @nrwl/cypress : 14.1.4
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.1.4
   @nrwl/eslint-plugin-nx : 14.1.4
   @nrwl/express : 14.1.4
   @nrwl/jest : 14.1.4
   @nrwl/js : 14.1.4
   @nrwl/linter : 14.1.4
   @nrwl/nest : 14.1.4
   @nrwl/next : Not Found
   @nrwl/node : 14.1.4
   @nrwl/nx-cloud : 14.0.3
   @nrwl/nx-plugin : 14.1.4
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.1.4
   @nrwl/web : 14.1.4
   @nrwl/workspace : 14.1.4
   typescript : 4.6.3
   rxjs : 7.4.0
nartc added a commit that referenced this issue May 14, 2022
nartc added a commit that referenced this issue May 16, 2022
nartc added a commit that referenced this issue May 17, 2022
nartc added a commit that referenced this issue May 19, 2022
nartc added a commit that referenced this issue May 20, 2022
nartc added a commit that referenced this issue May 20, 2022
#10297)

* feat(js): implement a smarter compiler (tsc, swc) helper dependency detection

ISSUES CLOSED: #10270

* chore(js): add test to check for swc/helpers upon build lib
@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.