Repository: swc-project/swc (rust)

Issue:
[Wrong] Es6/nodenext module only has a field named `resolveFully` and you should remove other fields.
### Describe the bug

Since `@swc/core@1.3.80`, my project - `@ducanh2912/next-pwa` - has been seeing this issue:

For me - building the package using `rollup` with `@rollup/plugin-swc`:
```
src/index.ts → dist/index.cjs, dist/index.module.js...
[!] (plugin swc) Error: unknown field `lazy`, expected `resolveFully` at line 1 column 444
src/index.ts
Error: unknown field `lazy`, expected `resolveFully` at line 1 column 444
```

For people who use my project:
```
 x (pwa) Failed to build the fallback worker.
 x (pwa) assets by status 268 bytes [cached] 1 asset
./node_modules/.pnpm/@ducanh2912+next-pwa@9.7.0_next@13.5.1_webpack@5.88.2/node_...(truncated) 39 bytes [built] [code generated] [1 error]

ERROR in ./node_modules/.pnpm/@ducanh2912+next-pwa@9.7.0_next@13.5.1_webpack@5.88.2/node_modules/@ducanh2912/next-pwa/dist/fallback.js
Module build failed (from ./node_modules/.pnpm/@ducanh2912+next-pwa@9.7.0_next@13.5.1_webpack@5.88.2/node_modules/@ducanh2912/next-pwa/dist/swc-loader.cjs):
Error: unknown field `lazy`, expected `resolveFully` at line 1 column 639

webpack 5.86.0 compiled with 1 error in 238 ms
```

This seems to only stop happening if I remove `module.lazy` and `module.noInterop` from `.swcrc`, but they don't seem to have been removed at all, which tells me that this is likely a bug.

### Input code

Link to the repo: https://github.com/DuCanhGH/next-pwa/tree/master/packages/next-pwa

Code compiled on users' end:

```typescript
self.fallback = async (request) => {
  // https://developer.mozilla.org/en-US/docs/Web/API/RequestDestination
  const { destination, url } = request;
  const fallbackUrl: Partial<Record<RequestDestination, string | undefined>> = {
    document: process.env.__PWA_FALLBACK_DOCUMENT__,
    image: process.env.__PWA_FALLBACK_IMAGE__,
    audio: process.env.__PWA_FALLBACK_AUDIO__,
    video: process.env.__PWA_FALLBACK_VIDEO__,
    font: process.env.__PWA_FALLBACK_FONT__,
  };
  const fallbackResponse = fallbackUrl[destination];
  if (fallbackResponse) {
    return caches.match(fallbackResponse, {
      ignoreSearch: true,
    });
  }
  if (
    destination === "" &&
    process.env.__PWA_FALLBACK_DATA__ &&
    url.match(/\/_next\/data\/.+\/.+\.json$/i)
  ) {
    return caches.match(process.env.__PWA_FALLBACK_DATA__, {
      ignoreSearch: true,
    });
  }
  return Response.error();
};

// Mark file as module.
export {};
```


### Config
Config used to compile the package itself:
```js
// @ts-check
/**
 * @type {import("@swc/core").Config}
 */
export const swcConfig = {
  module: {
    type: "nodenext",
    lazy: true,
    importInterop: "swc",
  },
  jsc: {
    minify: {
      compress: {
        ecma: 5,
        comparisons: false,
        inline: 2,
      },
      mangle: {
        safari10: true,
      },
      format: {
        ecma: 5,
        safari10: true,
        comments: false,
        asciiOnly: true,
      },
    },
    parser: {
      syntax: "typescript",
      tsx: false,
      dynamicImport: true,
      decorators: false,
    },
    transform: {
      react: undefined,
    },
    target: "esnext",
    loose: false,
  },
};
```

Config used to compile on users' end:
```ts
import type { Options } from "@swc/core";

export const defaultSwcRc: Options = {
  module: {
    type: "es6",
    lazy: true,
    noInterop: true,
  },
  jsc: {
    parser: {
      syntax: "typescript",
      tsx: true,
      dynamicImport: true,
      decorators: false,
    },
    transform: {
      react: {
        runtime: "automatic",
      },
    },
    loose: false,
  },
  minify: false,
};
```

### Playground link

https://play.swc.rs/?version=1.3.80&code=H4sIAAAAAAAAA5VTwW4aMRC98xWjqIpApfadZJG2gVSooSASmkOJLMeeBTdee2t7Udp0%2F70GdpOoSBvl4Iv95r03bzwedUYyrvU9Fw%2BQAPe%2FjYCuw18l%2BtCDZAhPHQBKYRNC4QeUStyitgU6kts%2FSmtOrFtTNJ%2BW11Ra4ekt3tN0PqGLA8coHmV4UNZEImGND%2FAE8uW2D6XTUEXxWvXsGdcYWzo9gDl3QXF9vkBhnTw%2Fpu%2BDD06ZNfyF0kjMlEE5HEbeXQcA0VyZowkDKJwV6D1BsyWMzW9TdpleXX1OL76y0exiOR1%2Fu2Gsvy9SOV9ja8Vkmn4ZN3BeSmVb4elyNJk18K2S2A7%2FPhmNn%2BGZfcP95axxXh2HuEBfxAuMgbzK9cerSdztilQG3f9LenWEDkPpDAguNuhJzoPYHGH7NTYyrY11eI3cic0Agivx0EbV2%2BlUtdZhNi8mIEkSODmB09P9S9us0puUsQYYP1HtiK4oM%2FgYVlTywFeUfNwf8tNb84GqXoS3NfSm4ns6rAWacAg6Z103PscBdeJWTbl7gExpjJsHuZWlRtLBx8K6uCXV2T%2B8Oe6unwMAAA%3D%3D&config=H4sIAAAAAAAAA1WPQQ7DIAwE731FxLnnHvqDPsMijkQFGNlGCq34eyFBaXLcWWnH%2Ft6myQSas0fznL4ttawl9WRQHua%2BIw%2Bf0pByxkEivaIiUxq40dor8xb7n0rAgnzkRqREhbXPd41YdkmHpatlvWgamtESgxJLaxbwgltTxx3KEGUhDmcJI1g9gY5yVBe2vyArBVBnzajrZdETCZ5c%2B1vBRbeUA9cfInoy3ToBAAA%3D

### SWC Info output


    Operating System:
        Platform: linux
        Arch: x64
        Machine Type: x86_64
        Version: #1 SMP PREEMPT_DYNAMIC Wed, 06 Sep 2023 21:01:01 +0000
        CPU: (12 cores)
            Models: AMD Ryzen 5 5500

    Binaries:
        Node: 18.16.0
        npm: 9.5.1
        Yarn: 1.22.19
        pnpm: 8.7.5

    Relevant Packages:
        @swc/core: 1.3.86
        @swc/helpers: N/A
        @swc/types: N/A
        typescript: 5.3.0-dev.20230915
        next: 13.4.19

    SWC Config:
        output: N/A
        .swcrc path: N/A

    Next.js info:
        output: N/A


### Expected behavior

This issue shouldn't happen, and the code should be compiled successfully like in `@swc/core@1.3.78` and below.

### Actual behavior

The error happens as described in section "Describe the bug".

### Version

1.3.86

### Additional context

On users' end, seems that even installing `@swc/core@1.3.8x` works (this forces `next-pwa` to resolve to that `swc` instead of Next's internal `swc`), but this is not the case for the package itself. Only by pinning `@swc/core` to `1.3.78` can I get it to build.

Pull request:
chore(es/module): Remove `serde(deny_unknown_fields)`
**Related issue:**

 - Closes #7979

Patch:
diff --git a/crates/swc_ecma_transforms_module/src/lib.rs b/crates/swc_ecma_transforms_module/src/lib.rs
index c38ce19cb9..55c7da5163 100644
--- a/crates/swc_ecma_transforms_module/src/lib.rs
+++ b/crates/swc_ecma_transforms_module/src/lib.rs
@@ -22,7 +22,7 @@ mod top_level_this;
 pub mod umd;
 
 #[derive(Debug, Default, Clone, Serialize, Deserialize)]
-#[serde(deny_unknown_fields, rename_all = "camelCase")]
+#[serde(rename_all = "camelCase")]
 pub struct EsModuleConfig {
     #[serde(default)]
     pub resolve_fully: bool,
diff --git a/crates/swc_ecma_transforms_module/src/path.rs b/crates/swc_ecma_transforms_module/src/path.rs
index 7c33109ef7..e148d27d3e 100644
--- a/crates/swc_ecma_transforms_module/src/path.rs
+++ b/crates/swc_ecma_transforms_module/src/path.rs
@@ -122,7 +122,7 @@ where
                 base_dir.is_absolute(),
                 "base_dir(`{}`) must be absolute. Please ensure that `jsc.baseUrl` is specified \
                  correctly. This cannot be deduced by SWC itself because SWC is a transpiler and \
-                 it does not try to resolve project details. In other works, SWC does not know \
+                 it does not try to resolve project details. In other words, SWC does not know \
                  which directory should be used as a base directory. It can be deduced if \
                  `.swcrc` is used, but if not, there are many candidates. e.g. the directory \
                  containing `package.json`, or the current working directory. Because of that, \


Test patch:
diff --git a/crates/swc_ecma_parser/tests/tsc/thisTypeInAccessors.json b/crates/swc_ecma_parser/tests/tsc/thisTypeInAccessors.json
index 87a7c96c07..a03bd64baf 100644
--- a/crates/swc_ecma_parser/tests/tsc/thisTypeInAccessors.json
+++ b/crates/swc_ecma_parser/tests/tsc/thisTypeInAccessors.json
@@ -277,37 +277,27 @@
                 "param": {
                   "type": "Identifier",
                   "span": {
-                    "start": 204,
-                    "end": 213,
+                    "start": 215,
+                    "end": 224,
                     "ctxt": 0
                   },
-                  "value": "this",
+                  "value": "n",
                   "optional": false,
                   "typeAnnotation": {
                     "type": "TsTypeAnnotation",
                     "span": {
-                      "start": 208,
-                      "end": 213,
+                      "start": 216,
+                      "end": 224,
                       "ctxt": 0
                     },
                     "typeAnnotation": {
-                      "type": "TsTypeReference",
+                      "type": "TsKeywordType",
                       "span": {
-                        "start": 210,
-                        "end": 213,
+                        "start": 218,
+                        "end": 224,
                         "ctxt": 0
                       },
-                      "typeName": {
-                        "type": "Identifier",
-                        "span": {
-                          "start": 210,
-                          "end": 213,
-                          "ctxt": 0
-                        },
-                        "value": "Foo",
-                        "optional": false
-                      },
-                      "typeParams": null
+                      "kind": "number"
                     }
                   }
                 },
@@ -759,37 +749,27 @@
                 "param": {
                   "type": "Identifier",
                   "span": {
-                    "start": 441,
-                    "end": 450,
+                    "start": 452,
+                    "end": 461,
                     "ctxt": 0
                   },
-                  "value": "this",
+                  "value": "n",
                   "optional": false,
                   "typeAnnotation": {
                     "type": "TsTypeAnnotation",
                     "span": {
-                      "start": 445,
-                      "end": 450,
+                      "start": 453,
+                      "end": 461,
                       "ctxt": 0
                     },
                     "typeAnnotation": {
-                      "type": "TsTypeReference",
+                      "type": "TsKeywordType",
                       "span": {
-                        "start": 447,
-                        "end": 450,
+                        "start": 455,
+                        "end": 461,
                         "ctxt": 0
                       },
-                      "typeName": {
-                        "type": "Identifier",
-                        "span": {
-                          "start": 447,
-                          "end": 450,
-                          "ctxt": 0
-                        },
-                        "value": "Foo",
-                        "optional": false
-                      },
-                      "typeParams": null
+                      "kind": "number"
                     }
                   }
                 },
@@ -1005,11 +985,11 @@
                 "param": {
                   "type": "Identifier",
                   "span": {
-                    "start": 580,
-                    "end": 584,
+                    "start": 586,
+                    "end": 587,
                     "ctxt": 0
                   },
-                  "value": "this",
+                  "value": "n",
                   "optional": false,
                   "typeAnnotation": null
                 },
diff --git a/crates/swc_ecma_parser/tests/tsc/thisTypeInAccessorsNegative.json b/crates/swc_ecma_parser/tests/tsc/thisTypeInAccessorsNegative.json
index 98b516b7fa..1a8333bed8 100644
--- a/crates/swc_ecma_parser/tests/tsc/thisTypeInAccessorsNegative.json
+++ b/crates/swc_ecma_parser/tests/tsc/thisTypeInAccessorsNegative.json
@@ -406,39 +406,13 @@
                 "param": {
                   "type": "Identifier",
                   "span": {
-                    "start": 267,
-                    "end": 276,
+                    "start": 278,
+                    "end": 279,
                     "ctxt": 0
                   },
-                  "value": "this",
+                  "value": "n",
                   "optional": false,
-                  "typeAnnotation": {
-                    "type": "TsTypeAnnotation",
-                    "span": {
-                      "start": 271,
-                      "end": 276,
-                      "ctxt": 0
-                    },
-                    "typeAnnotation": {
-                      "type": "TsTypeReference",
-                      "span": {
-                        "start": 273,
-                        "end": 276,
-                        "ctxt": 0
-                      },
-                      "typeName": {
-                        "type": "Identifier",
-                        "span": {
-                          "start": 273,
-                          "end": 276,
-                          "ctxt": 0
-                        },
-                        "value": "Bar",
-                        "optional": false
-                      },
-                      "typeParams": null
-                    }
-                  }
+                  "typeAnnotation": null
                 },
                 "body": {
                   "type": "BlockStatement",