-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Open
Labels
SWCRelated to minification/transpilation in Next.js.Related to minification/transpilation in Next.js.bugIssue was opened via the bug report template.Issue was opened via the bug report template.
Description
Link to the code that reproduces this issue
https://stackblitz.com/edit/nextjs-wzyqzn?file=app%2Fpage.tsx
To Reproduce
just open the stackblize online reproduce
Current vs. Expected behavior
class Father {
static instance = {};
static register() {
return (target) => {
class Wrapper extends target {
constructor(props) {
super({
...props,
});
}
}
this.instance = new Wrapper();
};
}
private _a = 1;
constructor() {
this._a = 2;
}
}
@Father.register()
class Son {}
console.log(Father.instance._a); // 1, but why ???
expect
should compile correct
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: Ubuntu 20.04.0 LTS Wed May 22 2024 23:45:04 GMT+0800 (中国标准时间)
Binaries:
Node: 18.20.3
npm: 10.2.3
Yarn: 1.22.19
pnpm: 8.15.6
Relevant Packages:
next: 14.1.0
eslint-config-next: 13.5.1
react: 18.2.0
react-dom: 18.2.0
typescript: 5.2.2
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
SWC
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
The latest canary version fix this issue, but I can find a good way to fix it now.
I want to use canary but it require react19.
I try use yarn1 resolution to lock the next swc version, but yarn1 seems can't correctly deal with resolution with optionalDependencies:
So, I thing the best method way to fix this is the nextjs official release a new 14.x version.
I think the compile error is a serious error and cost me one day to locate it.
more context:
Metadata
Metadata
Assignees
Labels
SWCRelated to minification/transpilation in Next.js.Related to minification/transpilation in Next.js.bugIssue was opened via the bug report template.Issue was opened via the bug report template.
