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

[Bug]: When using the decorator syntax, the build product is incorrect and does not work properly in @modern-js/module-tools@2.22.0 #3892

Closed
targeral opened this issue Jun 8, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@targeral
Copy link
Member

targeral commented Jun 8, 2023

Version

npmPackages: @modern-js/module-tools@2.22.0

Details

image

The use of swc transform in @modern-js/module-tools@2.22.0 has resulted in a change in the handling of class. When using the decorator syntax, the product behaves in a way that is not expected during runtime.

Should need to support behavior similar to typescript's useDefineForClassFields configuration.

Related Links:

Handling of this configuration by swc and esbuild:

Reproduce link

none

Reproduce Steps

Demo Code:

import 'reflect-metadata';

function Service(options?: {}): any {
  return (target: any): any => target;
}

class AbstractLine {
  constructor() {}
}

@Service()
class Line extends AbstractLine {
  private b: string;

  constructor(private a: string) {
    super();
  }
}
@targeral targeral added the bug Something isn't working label Jun 8, 2023
@targeral targeral self-assigned this Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant