diff --git a/packages/next-swc/crates/next-custom-transforms/src/transforms/cjs_optimizer.rs b/packages/next-swc/crates/next-custom-transforms/src/transforms/cjs_optimizer.rs index a94a1f3ed8edfa..69f1553c4c34b5 100644 --- a/packages/next-swc/crates/next-custom-transforms/src/transforms/cjs_optimizer.rs +++ b/packages/next-swc/crates/next-custom-transforms/src/transforms/cjs_optimizer.rs @@ -131,7 +131,7 @@ impl VisitMut for CjsOptimizer { definite: false, }; - if !self.data.extra_stmts.clone().into_iter().any(|s| { + if !self.data.extra_stmts.iter().any(|s| { if let Stmt::Decl(Decl::Var(v)) = &s { v.decls.iter().any(|d| d.name == var.name) } else { diff --git a/packages/next/src/build/swc/options.ts b/packages/next/src/build/swc/options.ts index a47a55c6de992e..aa32bb389f98a7 100644 --- a/packages/next/src/build/swc/options.ts +++ b/packages/next/src/build/swc/options.ts @@ -438,10 +438,7 @@ export function getLoaderSWCOptions({ isPageFile, env: { // Workaround acorn issues - include: [ - 'transform-private-methods', - 'transform-private-property-in-object', - ], + include: ['transform-class-properties'], targets: { // Targets the current version of Node.js node: process.versions.node, diff --git a/test/e2e/app-dir/ecmascript-features/webpack/app/page.tsx b/test/e2e/app-dir/ecmascript-features/webpack/app/page.tsx index b624643b3c841f..2900b2de8b4d84 100644 --- a/test/e2e/app-dir/ecmascript-features/webpack/app/page.tsx +++ b/test/e2e/app-dir/ecmascript-features/webpack/app/page.tsx @@ -33,10 +33,9 @@ class ClassWithPrivate { getPrivateStaticMethod() { return ClassWithPrivate.#privateStaticMethod() } - // TODO: Not supported in webpack yet. - // isPrivateMethodAvailable() { - // return #privateField in this - // } + isPrivateMethodAvailable() { + return #privateField in this + } } // Not supported in Node.js yet. @@ -57,8 +56,7 @@ export default function Page() { privateStaticFieldWithInitializer: instance.getPrivateStaticFieldWithInitializer(), privateStaticMethod: instance.getPrivateStaticMethod(), - // TODO: Not supported in webpack yet. - // privateMethodInThis: instance.isPrivateMethodAvailable(), + privateMethodInThis: instance.isPrivateMethodAvailable(), exportAs: abc, importWith: json.message, // Not supported in Node.js yet. diff --git a/test/e2e/app-dir/ecmascript-features/webpack/ecmascript-features-webpack.test.ts b/test/e2e/app-dir/ecmascript-features/webpack/ecmascript-features-webpack.test.ts index 10fbb02432f231..0f9000eeaf3971 100644 --- a/test/e2e/app-dir/ecmascript-features/webpack/ecmascript-features-webpack.test.ts +++ b/test/e2e/app-dir/ecmascript-features/webpack/ecmascript-features-webpack.test.ts @@ -14,7 +14,7 @@ import { nextTestSetup } from 'e2e-utils' privateFieldWithInitializer: 11, privateStaticFieldWithInitializer: 12, privateStaticMethod: 12, - // privateMethodInThis: true, + privateMethodInThis: true, exportAs: 1, // regex: true, importWith: 'Hello World', @@ -37,7 +37,7 @@ import { nextTestSetup } from 'e2e-utils' privateFieldWithInitializer: 11, privateStaticFieldWithInitializer: 12, privateStaticMethod: 12, - // privateMethodInThis: true, + privateMethodInThis: true, exportAs: 1, // regex: true, importWith: 'Hello World',