diff --git a/CODEOWNERS b/CODEOWNERS
index b117b96129..829108e90c 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -106,6 +106,9 @@ rust-toolchain @nrwl/nx-native-reviewers
/packages/vite/** @nrwl/nx-js-reviewers
/e2e/vite/** @nrwl/nx-js-reviewers
+## Module Federation
+/packages/module-federation/** @nrwl/nx-js-reviewers
+
## Tools
/docs/generated/packages/cypress/** @nrwl/nx-testing-tools-reviewers @nrwl/nx-docs-reviewers
/docs/shared/packages/cypress/** @nrwl/nx-testing-tools-reviewers @nrwl/nx-docs-reviewers
diff --git a/docs/generated/manifests/menus.json b/docs/generated/manifests/menus.json
index e3a817a154..b018accb68 100644
--- a/docs/generated/manifests/menus.json
+++ b/docs/generated/manifests/menus.json
@@ -8203,6 +8203,14 @@
"isExternal": false,
"disableCollapsible": false
},
+ {
+ "id": "module-federation",
+ "path": "/nx-api/module-federation",
+ "name": "module-federation",
+ "children": [],
+ "isExternal": false,
+ "disableCollapsible": false
+ },
{
"id": "nest",
"path": "/nx-api/nest",
diff --git a/docs/generated/manifests/nx-api.json b/docs/generated/manifests/nx-api.json
index bf0d87f8db..d31d49be7b 100644
--- a/docs/generated/manifests/nx-api.json
+++ b/docs/generated/manifests/nx-api.json
@@ -1306,6 +1306,18 @@
},
"path": "/nx-api/js"
},
+ "module-federation": {
+ "githubRoot": "https://github.com/nrwl/nx/blob/master",
+ "name": "module-federation",
+ "packageName": "@nx/module-federation",
+ "description": "The Nx Plugin for Module Federation contains executors and utilities that support building applications using Module Federation.",
+ "documents": {},
+ "root": "/packages/module-federation",
+ "source": "/packages/module-federation/src",
+ "executors": {},
+ "generators": {},
+ "path": "/nx-api/module-federation"
+ },
"nest": {
"githubRoot": "https://github.com/nrwl/nx/blob/master",
"name": "nest",
diff --git a/docs/generated/packages-metadata.json b/docs/generated/packages-metadata.json
index 20745b2d6f..aa253011a3 100644
--- a/docs/generated/packages-metadata.json
+++ b/docs/generated/packages-metadata.json
@@ -1292,6 +1292,17 @@
"root": "/packages/js",
"source": "/packages/js/src"
},
+ {
+ "description": "The Nx Plugin for Module Federation contains executors and utilities that support building applications using Module Federation.",
+ "documents": [],
+ "executors": [],
+ "generators": [],
+ "githubRoot": "https://github.com/nrwl/nx/blob/master",
+ "name": "module-federation",
+ "packageName": "@nx/module-federation",
+ "root": "/packages/module-federation",
+ "source": "/packages/module-federation/src"
+ },
{
"description": "The Nx Plugin for Nest contains executors and generators for allowing your workspace to create powerful Nest best in class APIs.",
"documents": [
diff --git a/docs/shared/reference/sitemap.md b/docs/shared/reference/sitemap.md
index f9cee2cba4..8279fba449 100644
--- a/docs/shared/reference/sitemap.md
+++ b/docs/shared/reference/sitemap.md
@@ -491,6 +491,7 @@
- [setup-build](/nx-api/js/generators/setup-build)
- [typescript-sync](/nx-api/js/generators/typescript-sync)
- [setup-prettier](/nx-api/js/generators/setup-prettier)
+ - [module-federation](/nx-api/module-federation)
- [nest](/nx-api/nest)
- [documents](/nx-api/nest/documents)
- [Overview](/nx-api/nest/documents/overview)
diff --git a/packages/module-federation/.eslintrc.json b/packages/module-federation/.eslintrc.json
new file mode 100644
index 0000000000..85e1f5edfb
--- /dev/null
+++ b/packages/module-federation/.eslintrc.json
@@ -0,0 +1,45 @@
+{
+ "extends": ["../../.eslintrc.json"],
+ "ignorePatterns": ["!**/*"],
+ "overrides": [
+ {
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
+ "rules": {}
+ },
+ {
+ "files": ["*.ts", "*.tsx"],
+ "rules": {}
+ },
+ {
+ "files": ["*.js", "*.jsx"],
+ "rules": {}
+ },
+ {
+ "files": ["./package.json", "./generators.json", "./executors.json"],
+ "parser": "jsonc-eslint-parser",
+ "rules": {
+ "@nx/nx-plugin-checks": "error"
+ }
+ },
+ {
+ "files": ["./package.json"],
+ "parser": "jsonc-eslint-parser",
+ "rules": {
+ "@nx/dependency-checks": [
+ "error",
+ {
+ "buildTargets": ["build-base"],
+ "ignoredDependencies": [
+ "nx",
+ "eslint",
+ "typescript",
+ "@nx/cypress",
+ "@nx/playwright",
+ "@nx/vite"
+ ]
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/packages/module-federation/README.md b/packages/module-federation/README.md
new file mode 100644
index 0000000000..7ff5a6dc3d
--- /dev/null
+++ b/packages/module-federation/README.md
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+{{links}}
+
+
+
+# Nx: Smart Monorepos · Fast CI
+
+Nx is a build system, optimized for monorepos, with plugins for popular frameworks and tools and advanced CI capabilities including caching and distribution.
+
+This package is a [Module Federation plugin for Nx](https://nx.dev/nx-api/module-federation).
+
+{{content}}
diff --git a/packages/module-federation/executors.json b/packages/module-federation/executors.json
new file mode 100644
index 0000000000..b64f99d988
--- /dev/null
+++ b/packages/module-federation/executors.json
@@ -0,0 +1,4 @@
+{
+ "$schema": "http://json-schema.org/schema",
+ "executors": {}
+}
diff --git a/packages/module-federation/index.ts b/packages/module-federation/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/module-federation/jest.config.ts b/packages/module-federation/jest.config.ts
new file mode 100644
index 0000000000..79612dcfd1
--- /dev/null
+++ b/packages/module-federation/jest.config.ts
@@ -0,0 +1,16 @@
+/* eslint-disable */
+export default {
+ displayName: 'module-federation',
+ preset: '../../jest.preset.js',
+ globals: {},
+ transform: {
+ '^.+\\.[tj]s$': [
+ 'ts-jest',
+ {
+ tsconfig: '/tsconfig.spec.json',
+ },
+ ],
+ },
+ moduleFileExtensions: ['ts', 'js', 'html'],
+ coverageDirectory: '../../coverage/packages/module-federation',
+};
diff --git a/packages/module-federation/migrations.json b/packages/module-federation/migrations.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/packages/module-federation/migrations.json
@@ -0,0 +1 @@
+{}
diff --git a/packages/module-federation/package.json b/packages/module-federation/package.json
new file mode 100644
index 0000000000..be727b51d1
--- /dev/null
+++ b/packages/module-federation/package.json
@@ -0,0 +1,33 @@
+{
+ "name": "@nx/module-federation",
+ "description": "The Nx Plugin for Module Federation contains executors and utilities that support building applications using Module Federation.",
+ "version": "0.0.1",
+ "type": "commonjs",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/nrwl/nx.git",
+ "directory": "packages/module-federation"
+ },
+ "bugs": {
+ "url": "https://github.com/nrwl/nx/issues"
+ },
+ "keywords": [
+ "Monorepo",
+ "Rspack",
+ "Webpack",
+ "Bundling",
+ "Module Federation"
+ ],
+ "author": "Colum Ferry",
+ "license": "MIT",
+ "homepage": "https://nx.dev",
+ "main": "index.js",
+ "executors": "./executors.json",
+ "dependencies": {
+ "tslib": "^2.3.0"
+ },
+ "peerDependencies": {},
+ "nx-migrations": {
+ "migrations": "./migrations.json"
+ }
+}
diff --git a/packages/module-federation/project.json b/packages/module-federation/project.json
new file mode 100644
index 0000000000..70a094ad8e
--- /dev/null
+++ b/packages/module-federation/project.json
@@ -0,0 +1,60 @@
+{
+ "name": "module-federation",
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
+ "sourceRoot": "packages/module-federation",
+ "projectType": "library",
+ "targets": {
+ "build-base": {
+ "executor": "@nx/js:tsc",
+ "options": {
+ "outputPath": "build/packages/module-federation",
+ "tsConfig": "packages/module-federation/tsconfig.lib.json",
+ "main": "packages/module-federation/index.ts",
+ "generateExportsField": true,
+ "additionalEntryPoints": [
+ "{projectRoot}/{executors,generators,migrations}.json",
+ "{projectRoot}/plugin.ts"
+ ],
+ "assets": [
+ {
+ "input": "packages/module-federation",
+ "glob": "**/files/**",
+ "output": "/"
+ },
+ {
+ "input": "packages/module-federation",
+ "glob": "**/files/**/.gitkeep",
+ "output": "/"
+ },
+ {
+ "input": "packages/module-federation",
+ "glob": "**/*.json",
+ "ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"],
+ "output": "/"
+ },
+ {
+ "input": "packages/module-federation",
+ "glob": "**/*.js",
+ "ignore": ["**/jest.config.js"],
+ "output": "/"
+ },
+ {
+ "input": "packages/module-federation",
+ "glob": "**/*.d.ts",
+ "output": "/"
+ },
+ {
+ "input": "",
+ "glob": "LICENSE",
+ "output": "/"
+ }
+ ]
+ },
+ "outputs": ["{options.outputPath}"]
+ },
+ "build": {
+ "command": "node ./scripts/copy-readme.js module-federation",
+ "outputs": ["{workspaceRoot}/build/packages/module-federation"]
+ }
+ }
+}
diff --git a/packages/module-federation/tsconfig.json b/packages/module-federation/tsconfig.json
new file mode 100644
index 0000000000..19b9eece4d
--- /dev/null
+++ b/packages/module-federation/tsconfig.json
@@ -0,0 +1,16 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "compilerOptions": {
+ "module": "commonjs"
+ },
+ "files": [],
+ "include": [],
+ "references": [
+ {
+ "path": "./tsconfig.lib.json"
+ },
+ {
+ "path": "./tsconfig.spec.json"
+ }
+ ]
+}
diff --git a/packages/module-federation/tsconfig.lib.json b/packages/module-federation/tsconfig.lib.json
new file mode 100644
index 0000000000..7bfc80f73e
--- /dev/null
+++ b/packages/module-federation/tsconfig.lib.json
@@ -0,0 +1,10 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "outDir": "../../dist/out-tsc",
+ "declaration": true,
+ "types": ["node"]
+ },
+ "include": ["**/*.ts"],
+ "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"]
+}
diff --git a/packages/module-federation/tsconfig.spec.json b/packages/module-federation/tsconfig.spec.json
new file mode 100644
index 0000000000..546f12877f
--- /dev/null
+++ b/packages/module-federation/tsconfig.spec.json
@@ -0,0 +1,9 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "outDir": "../../dist/out-tsc",
+ "module": "commonjs",
+ "types": ["jest", "node"]
+ },
+ "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
+}