Skip to content

Commit a047837

Browse files
fix(nextjs-mf): enable async function support (#2642)
Co-authored-by: ScriptedAlchemy <[email protected]>
1 parent 88445e7 commit a047837

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

.changeset/old-teachers-eat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@module-federation/nextjs-mf': patch
3+
---
4+
5+
async function enable to stop warnings

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
run: npx nx run-many --target=test:e2e --projects=modernjs --parallel=1 && lsof -ti tcp:4001 | xargs kill
7575

7676
- name: E2E Test for 3005-runtime-host
77-
run: lsof -ti tcp:3005,3006,3007 | xargs kill & pnpm run app:runtime:dev & echo "done" && sleep 20 && npx nx run-many --target=test:e2e --projects=3005-runtime-host --parallel=1 && lsof -ti tcp:3005,3006,3007 | xargs kill
77+
run: npx kill-port --port 3005,3006,3007 && pnpm run app:runtime:dev & echo "done" && sleep 20 && npx nx run-many --target=test:e2e --projects=3005-runtime-host --parallel=1 && lsof -ti tcp:3005,3006,3007 | xargs kill
7878

7979
- name: E2E Test for 3008-webpack-host
8080
run: pnpm run app:manifest:dev & echo "done" && npx wait-on tcp:3009 && npx wait-on tcp:3012 && npx nx run-many --target=e2e --projects=3008-webpack-host --parallel=1 && lsof -ti tcp:3008,3009,3010,3011,3012 | xargs kill

packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ export class NextFederationPlugin {
119119

120120
private applyConditionalPlugins(compiler: Compiler, isServer: boolean) {
121121
compiler.options.output.uniqueName = this._options.name;
122+
compiler.options.output.environment = {
123+
...compiler.options.output.environment,
124+
asyncFunction: true,
125+
};
126+
122127
applyPathFixes(compiler, this._extraOptions);
123128
if (this._extraOptions.debug) {
124129
compiler.options.devtool = false;

webpack/types.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3670,6 +3670,11 @@ declare interface Environment {
36703670
*/
36713671
arrowFunction?: boolean;
36723672

3673+
/**
3674+
* The environment supports async function and await ('async function () { await ... }').
3675+
*/
3676+
asyncFunction?: boolean;
3677+
36733678
/**
36743679
* The environment supports BigInt as literal (123n).
36753680
*/
@@ -3720,6 +3725,7 @@ declare interface Environment {
37203725
*/
37213726
templateLiteral?: boolean;
37223727
}
3728+
37233729
declare class EnvironmentPlugin {
37243730
constructor(...keys: any[]);
37253731
keys: any[];
@@ -9200,6 +9206,11 @@ declare interface Output {
92009206
| string
92019207
| ((pathData: PathData, assetInfo?: AssetInfo) => string);
92029208

9209+
/**
9210+
* Compress the data in the head tag of CSS files.
9211+
*/
9212+
cssHeadDataCompression?: boolean;
9213+
92039214
/**
92049215
* Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
92059216
*/
@@ -9400,6 +9411,7 @@ declare interface Output {
94009411
*/
94019412
workerWasmLoading?: string | false;
94029413
}
9414+
94039415
declare interface OutputFileSystem {
94049416
writeFile: (
94059417
arg0: string,

0 commit comments

Comments
 (0)