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

fix(next-swc): Fix SWC env target - include option #65693

Merged
merged 8 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 1 addition & 4 deletions packages/next/src/build/swc/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 4 additions & 6 deletions test/e2e/app-dir/ecmascript-features/webpack/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down
Loading