diff --git a/packages/bridge/src/app.ts b/packages/bridge/src/app.ts index 1761031cd8..28f4f1f09e 100644 --- a/packages/bridge/src/app.ts +++ b/packages/bridge/src/app.ts @@ -46,13 +46,15 @@ export function setupAppBridge (_options: any) { // Fix wp4 esm nuxt.hook('webpack:config', (configs) => { for (const config of configs.filter(c => c.module)) { - for (const rule of config.module.rules) { - // @ts-ignore - if (rule.test instanceof RegExp && rule.test.test('index.mjs')) { - // @ts-ignore - rule.type = 'javascript/auto' - } - } + // @ts-ignore + const jsRule: any = config.module.rules.find(rule => rule.test instanceof RegExp && rule.test.test('index.mjs')) + jsRule.type = 'javascript/auto' + + config.module.rules.unshift({ + test: /\.mjs$/, + type: 'javascript/auto', + include: [/node_modules/] + }) } }) } diff --git a/packages/bridge/src/nitro.ts b/packages/bridge/src/nitro.ts index 1848ff839a..b24d9fb1be 100644 --- a/packages/bridge/src/nitro.ts +++ b/packages/bridge/src/nitro.ts @@ -21,6 +21,9 @@ export function setupNitroBridge () { // @ts-ignore nuxt.options.build.indicator = false + // Disable fetch polyfill (nitro provides it) + nuxt.options.fetch.server = false + // Create contexts const nitroOptions = (nuxt.options as any).nitro || {} const nitroContext = getNitroContext(nuxt.options, nitroOptions) diff --git a/packages/nitro/package.json b/packages/nitro/package.json index f1e895ca9e..b29dd3ebf6 100644 --- a/packages/nitro/package.json +++ b/packages/nitro/package.json @@ -52,7 +52,7 @@ "mime": "^2.5.2", "mlly": "^0.3.0", "node-fetch": "^3.0.0", - "ohmyfetch": "^0.3.1", + "ohmyfetch": "^0.4.2", "ora": "^6.0.1", "p-debounce": "^4.0.0", "pathe": "^0.2.0", @@ -65,7 +65,7 @@ "std-env": "^2.3.1", "table": "^6.7.2", "ufo": "^0.7.9", - "unenv": "^0.3.10", + "unenv": "^0.4.0", "unstorage": "^0.2.9", "vue-bundle-renderer": "^0.3.2", "vue-server-renderer": "^2.6.14" diff --git a/packages/nuxt3/package.json b/packages/nuxt3/package.json index 149701f2a2..f0e6c11ff0 100644 --- a/packages/nuxt3/package.json +++ b/packages/nuxt3/package.json @@ -36,7 +36,7 @@ "mlly": "^0.3.0", "murmurhash-es": "^0.1.1", "nuxi": "3.0.0", - "ohmyfetch": "^0.3.1", + "ohmyfetch": "^0.4.2", "pathe": "^0.2.0", "scule": "^0.2.1", "ufo": "^0.7.9", diff --git a/yarn.lock b/yarn.lock index c69641ab55..69b4534326 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2667,7 +2667,7 @@ __metadata: mime: ^2.5.2 mlly: ^0.3.0 node-fetch: ^3.0.0 - ohmyfetch: ^0.3.1 + ohmyfetch: ^0.4.2 ora: ^6.0.1 p-debounce: ^4.0.0 pathe: ^0.2.0 @@ -2681,7 +2681,7 @@ __metadata: table: ^6.7.2 ufo: ^0.7.9 unbuild: latest - unenv: ^0.3.10 + unenv: ^0.4.0 unstorage: ^0.2.9 vue: 3.2.20 vue-bundle-renderer: ^0.3.2 @@ -13268,7 +13268,7 @@ fsevents@~2.3.2: languageName: node linkType: hard -"node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.2": +"node-fetch@npm:^2.6.1": version: 2.6.5 resolution: "node-fetch@npm:2.6.5" dependencies: @@ -13843,7 +13843,7 @@ fsevents@~2.3.2: mlly: ^0.3.0 murmurhash-es: ^0.1.1 nuxi: 3.0.0 - ohmyfetch: ^0.3.1 + ohmyfetch: ^0.4.2 pathe: ^0.2.0 scule: ^0.2.1 ufo: ^0.7.9 @@ -13995,6 +13995,17 @@ fsevents@~2.3.2: languageName: node linkType: hard +"ohmyfetch@npm:^0.4.2": + version: 0.4.2 + resolution: "ohmyfetch@npm:0.4.2" + dependencies: + destr: ^1.1.0 + node-fetch: ^3.0.0 + ufo: ^0.7.9 + checksum: 91cce3271b9e47e0c29d3cf25813b1c5076b15ad62ac81e8ce8d7153d906b4d36c60cffc3e03d9dd4745604ea8e4ca886d112db355bb2a4a8282658665530b80 + languageName: node + linkType: hard + "on-finished@npm:^2.3.0, on-finished@npm:~2.3.0": version: 2.3.0 resolution: "on-finished@npm:2.3.0" @@ -18843,20 +18854,20 @@ fsevents@~2.3.2: languageName: node linkType: hard -"unenv@npm:^0.3.10": - version: 0.3.10 - resolution: "unenv@npm:0.3.10" +"unenv@npm:^0.4.0": + version: 0.4.0 + resolution: "unenv@npm:0.4.0" dependencies: buffer: ^6.0.2 defu: ^5.0.0 events: ^3.2.0 inherits: ^2.0.4 mime: ^2.4.6 - node-fetch: ^2.6.2 + node-fetch: ^3.0.0 process: ^0.11.10 upath: ^2.0.1 util: ^0.12.4 - checksum: 502a699d88bbe45e26920d74dd756b63e78e748f73963a0c62b58584f974b856367d1c3c3d697f52b889b9cc1e750d3157caa5bb0d86c51cf32d482d5c383ec8 + checksum: d255476a4476b34f5e2be81a453f45dd62636b2b50077eca529a13d29e3fa931da5be12b20ffbe882f06ae944e311c03163ce09bbdbf2078f2116ed95b06094a languageName: node linkType: hard