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/webpack with swc doesn't work with reflect-metadata/emitDecoratorMetadata #12845

Closed
Bielik20 opened this issue Oct 27, 2022 · 9 comments
Closed

Comments

@Bielik20
Copy link
Contributor

Bielik20 commented Oct 27, 2022

main.ts

import { Injectable } from '@wikia/dependency-injection';
import { DepClass } from './dep';

@Injectable()
export class MainClass {
  constructor(public dep: DepClass) {}
}

dep.ts

import { Injectable } from '@wikia/dependency-injection';

@Injectable()
export class DepClass {
  foo() {
    return 'foo';
  }
}

Current Behavior

✅ Running @nrwl/webpack:webpack with "compiler": "tsc" includes DepClass in bundle.

❌ Running @nrwl/webpack:webpack with "compiler": "swc" excludes DepClass from bundle.

Expected Behavior

DepClass should be included in bundle.

According to swc-project/swc#3459 this should be fixed on the side of swc already.

Steps to Reproduce

PR example: nrwl/nx-examples#240

Run

  • yarn nx run di:build:tsc - ✅ DepClass is included.
  • yarn nx run di:build:swc - ❌ DepClass is NOT included.

Environment

   Node : 16.17.0
   OS   : darwin arm64
   yarn : 1.22.19

   nx : 15.0.0
   @nrwl/angular : 15.0.0
   @nrwl/cypress : 15.0.0
   @nrwl/detox : Not Found
   @nrwl/devkit : 15.0.0
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : 15.0.0
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 15.0.0
   @nrwl/js : 15.0.0
   @nrwl/linter : 15.0.0
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : 15.0.0
   @nrwl/nx-cloud : 14.7.0
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 15.0.0
   @nrwl/react-native : Not Found
   @nrwl/rollup : 15.0.0
   @nrwl/schematics : Not Found
   @nrwl/storybook : 15.0.0
   @nrwl/web : 15.0.0
   @nrwl/webpack : 15.0.0
   @nrwl/workspace : 15.0.0
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:
   	 @ngrx/component-store: 14.0.2
   	 @ngrx/effects: 14.0.2
   	 @ngrx/entity: 14.0.2
   	 @ngrx/router-store: 14.0.2
   	 @ngrx/store: 14.0.2
   	 @ngrx/store-devtools: 14.0.2

Related issues

@MarcieMarc425
Copy link

I wonder if this is related to #12782?

@Bielik20
Copy link
Contributor Author

@MarcieMarc425 Hmm, I don't think so. With optimization: false it still does NOT include DepClass

@github-actions
Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label Apr 27, 2023
@Bielik20
Copy link
Contributor Author

Still an issue, I have checked with recent version. Interestingly enough @nrwl/rspack works fine with SWC.

@github-actions github-actions bot removed the stale label Apr 28, 2023
@kodeine
Copy link

kodeine commented Jul 24, 2023

i am facing the same issue, can someone guide?

Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label Jan 21, 2024
@Bielik20
Copy link
Contributor Author

Haven't checked for the long time but I don't think it is resolved.

@jaysoo
Copy link
Member

jaysoo commented Jun 5, 2024

Checked it on latest and it is resolved. See the demo here: https://github.com/jaysoo/issue12845

@jaysoo jaysoo closed this as completed Jun 5, 2024
Copy link

github-actions bot commented Jul 6, 2024

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 Jul 6, 2024
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