From 71fa675ccf0b9511489389c7a90814765855cb9d Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Fri, 30 Aug 2024 18:45:26 -0700 Subject: [PATCH 01/17] perf: reduce chunk map if remote entry chunk --- ....timestamp-1725065688311-ff3d0baa61437.mjs | 133 ++++++++++++++++++ ....timestamp-1725065688435-91ac119551b5d.mjs | 84 +++++++++++ .../lib/sharing/ConsumeSharedRuntimeModule.ts | 25 ++-- 3 files changed, 233 insertions(+), 9 deletions(-) create mode 100644 packages/bridge/bridge-react/vite.config.ts.timestamp-1725065688311-ff3d0baa61437.mjs create mode 100644 packages/bridge/vue3-bridge/vite.config.ts.timestamp-1725065688435-91ac119551b5d.mjs diff --git a/packages/bridge/bridge-react/vite.config.ts.timestamp-1725065688311-ff3d0baa61437.mjs b/packages/bridge/bridge-react/vite.config.ts.timestamp-1725065688311-ff3d0baa61437.mjs new file mode 100644 index 0000000000..3ab63c7c9f --- /dev/null +++ b/packages/bridge/bridge-react/vite.config.ts.timestamp-1725065688311-ff3d0baa61437.mjs @@ -0,0 +1,133 @@ +// vite.config.ts +import { defineConfig } from "file:///Users/bytedance/dev/universe/node_modules/.pnpm/vite@5.2.11_@types+node@18.16.9_less@4.2.0_stylus@0.63.0/node_modules/vite/dist/node/index.js"; +import path from "path"; +import dts from "file:///Users/bytedance/dev/universe/node_modules/.pnpm/vite-plugin-dts@3.9.1_@types+node@18.16.9_rollup@4.19.0_typescript@5.5.2_vite@5.2.11/node_modules/vite-plugin-dts/dist/index.mjs"; + +// package.json +var package_default = { + name: "@module-federation/bridge-react", + version: "0.6.0", + publishConfig: { + access: "public" + }, + author: "zhouxiao ", + type: "module", + main: "./dist/index.cjs.js", + module: "./dist/index.es.js", + types: "./dist/index.d.ts", + exports: { + ".": { + types: "./dist/index.d.ts", + import: "./dist/index.es.js", + require: "./dist/index.cjs.js" + }, + "./router": { + types: "./dist/router.d.ts", + import: "./dist/router.es.js", + require: "./dist/router.cjs.js" + }, + "./router-v5": { + types: "./dist/router-v5.d.ts", + import: "./dist/router-v5.es.js", + require: "./dist/router-v5.cjs.js" + }, + "./router-v6": { + types: "./dist/router-v6.d.ts", + import: "./dist/router-v6.es.js", + require: "./dist/router-v6.cjs.js" + }, + "./*": "./*" + }, + scripts: { + dev: "vite", + build: "vite build", + preview: "vite preview" + }, + dependencies: { + "@loadable/component": "^5.16.4", + "@module-federation/bridge-shared": "workspace:*", + "react-error-boundary": "^4.0.13" + }, + peerDependencies: { + react: ">=16.9.0", + "react-dom": ">=16.9.0", + "react-router-dom": ">=4" + }, + devDependencies: { + "@testing-library/react": "15.0.7", + "@types/react": "18.2.79", + "@types/react-dom": "18.2.25", + "@vitejs/plugin-react": "^4.3.0", + "@vitejs/plugin-vue": "^5.0.4", + "@vitejs/plugin-vue-jsx": "^4.0.0", + jsdom: "^24.1.0", + react: "18.1.0", + "react-dom": "18.1.0", + "react-router-dom": "6.22.3", + typescript: "^5.2.2", + vite: "^5.2.0", + "vite-plugin-dts": "^3.9.1" + } +}; + +// vite.config.ts +var __vite_injected_original_dirname = "/Users/bytedance/dev/universe/packages/bridge/bridge-react"; +var perDepsKeys = Object.keys(package_default.peerDependencies); +var vite_config_default = defineConfig({ + plugins: [ + dts({ + rollupTypes: true, + bundledPackages: [ + "@module-federation/bridge-shared", + "react-error-boundary" + ] + }) + ], + build: { + lib: { + entry: { + index: path.resolve(__vite_injected_original_dirname, "src/index.ts"), + router: path.resolve(__vite_injected_original_dirname, "src/router.tsx"), + "router-v5": path.resolve(__vite_injected_original_dirname, "src/router-v5.tsx"), + "router-v6": path.resolve(__vite_injected_original_dirname, "src/router-v6.tsx") + }, + formats: ["cjs", "es"], + fileName: (format, entryName) => `${entryName}.${format}.js` + }, + rollupOptions: { + external: [ + ...perDepsKeys, + "@remix-run/router", + "react-router", + "react-router-dom/", + "react-router-dom/index.js", + "react-router-dom/dist/index.js" + ], + plugins: [ + { + name: "modify-output-plugin", + generateBundle(options, bundle) { + for (const fileName in bundle) { + const chunk = bundle[fileName]; + if (fileName.includes("router-v5") && chunk.type === "chunk") { + chunk.code = chunk.code.replace( + // Match 'react-router-dom/' followed by single quotes, double quotes, or backticks, replacing only 'react-router-dom/' to react-router-v5 dist file structure + /react-router-dom\/(?=[\'\"\`])/g, + "react-router-dom/index.js" + ); + } + } + } + } + ] + }, + minify: false + }, + define: { + __APP_VERSION__: JSON.stringify(package_default.version) + } +}); +export { + vite_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiLCAicGFja2FnZS5qc29uIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZGlybmFtZSA9IFwiL1VzZXJzL2J5dGVkYW5jZS9kZXYvdW5pdmVyc2UvcGFja2FnZXMvYnJpZGdlL2JyaWRnZS1yZWFjdFwiO2NvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9maWxlbmFtZSA9IFwiL1VzZXJzL2J5dGVkYW5jZS9kZXYvdW5pdmVyc2UvcGFja2FnZXMvYnJpZGdlL2JyaWRnZS1yZWFjdC92aXRlLmNvbmZpZy50c1wiO2NvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9pbXBvcnRfbWV0YV91cmwgPSBcImZpbGU6Ly8vVXNlcnMvYnl0ZWRhbmNlL2Rldi91bml2ZXJzZS9wYWNrYWdlcy9icmlkZ2UvYnJpZGdlLXJlYWN0L3ZpdGUuY29uZmlnLnRzXCI7aW1wb3J0IHsgZGVmaW5lQ29uZmlnIH0gZnJvbSAndml0ZSc7XG5pbXBvcnQgdnVlIGZyb20gJ0B2aXRlanMvcGx1Z2luLXZ1ZSc7XG5pbXBvcnQgcGF0aCBmcm9tICdwYXRoJztcbmltcG9ydCBkdHMgZnJvbSAndml0ZS1wbHVnaW4tZHRzJztcbmltcG9ydCByZWFjdCBmcm9tICdAdml0ZWp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QSxNQUMxRDtBQUFBLE1BQ0EsU0FBUyxDQUFDLE9BQU8sSUFBSTtBQUFBLE1BQ3JCLFVBQVUsQ0FBQyxRQUFRLGNBQWMsR0FBRyxTQUFTLElBQUksTUFBTTtBQUFBLElBQ3pEO0FBQUEsSUFDQSxlQUFlO0FBQUEsTUFDYixVQUFVO0FBQUEsUUFDUixHQUFHO0FBQUEsUUFDSDtBQUFBLFFBQ0E7QUFBQSxRQUNBO0FBQUEsUUFDQTtBQUFBLFFBQ0E7QUFBQSxNQUNGO0FBQUEsTUFDQSxTQUFTO0FBQUEsUUFDUDtBQUFBLFVBQ0UsTUFBTTtBQUFBLFVBQ04sZUFBZSxTQUFTLFFBQVE7QUFDOUIsdUJBQVcsWUFBWSxRQUFRO0FBQzdCLG9CQUFNLFFBQVEsT0FBTyxRQUFRO0FBUzdCLGtCQUFJLFNBQVMsU0FBUyxXQUFXLEtBQUssTUFBTSxTQUFTLFNBQVM7QUFDNUQsc0JBQU0sT0FBTyxNQUFNLEtBQUs7QUFBQTtBQUFBLGtCQUV0QjtBQUFBLGtCQUNBO0FBQUEsZ0JBQ0Y7QUFBQSxjQUNGO0FBQUEsWUFDRjtBQUFBLFVBQ0Y7QUFBQSxRQUNGO0FBQUEsTUFDRjtBQUFBLElBQ0Y7QUFBQSxJQUNBLFFBQVE7QUFBQSxFQUNWO0FBQUEsRUFDQSxRQUFRO0FBQUEsSUFDTixpQkFBaUIsS0FBSyxVQUFVLGdCQUFZLE9BQU87QUFBQSxFQUNyRDtBQUNGLENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg== diff --git a/packages/bridge/vue3-bridge/vite.config.ts.timestamp-1725065688435-91ac119551b5d.mjs b/packages/bridge/vue3-bridge/vite.config.ts.timestamp-1725065688435-91ac119551b5d.mjs new file mode 100644 index 0000000000..257a01c8bf --- /dev/null +++ b/packages/bridge/vue3-bridge/vite.config.ts.timestamp-1725065688435-91ac119551b5d.mjs @@ -0,0 +1,84 @@ +// vite.config.ts +import { defineConfig } from "file:///Users/bytedance/dev/universe/node_modules/.pnpm/vite@5.2.11_@types+node@18.16.9_less@4.2.0_stylus@0.63.0/node_modules/vite/dist/node/index.js"; +import vue from "file:///Users/bytedance/dev/universe/node_modules/.pnpm/@vitejs+plugin-vue@5.1.0_vite@5.2.11_vue@3.4.34/node_modules/@vitejs/plugin-vue/dist/index.mjs"; +import path from "path"; +import dts from "file:///Users/bytedance/dev/universe/node_modules/.pnpm/vite-plugin-dts@3.9.1_@types+node@18.16.9_rollup@4.19.0_typescript@5.5.2_vite@5.2.11/node_modules/vite-plugin-dts/dist/index.mjs"; +import vueJsx from "file:///Users/bytedance/dev/universe/node_modules/.pnpm/@vitejs+plugin-vue-jsx@4.0.0_vite@5.2.11_vue@3.4.34/node_modules/@vitejs/plugin-vue-jsx/dist/index.mjs"; + +// package.json +var package_default = { + name: "@module-federation/bridge-vue3", + author: "zhouxiao ", + version: "0.6.0", + publishConfig: { + access: "public" + }, + type: "module", + main: "./dist/index.cjs.js", + module: "./dist/index.es.js", + types: "./dist/index.d.ts", + files: [ + "dist/", + "src/", + "CHANGELOG.md", + "LICENSE", + "package.json", + "project.json", + "README.md", + "tsconfig.json", + "tsconfig.node.json", + "vite.config.ts" + ], + scripts: { + dev: "vite", + build: "vite build", + preview: "vite preview" + }, + peerDependencies: { + vue: "=3", + "vue-router": "=3" + }, + dependencies: { + "@module-federation/bridge-shared": "workspace:*" + }, + devDependencies: { + "@vitejs/plugin-vue": "^5.0.4", + "@vitejs/plugin-vue-jsx": "^4.0.0", + typescript: "^5.2.2", + vite: "^5.2.0", + "vite-plugin-dts": "^3.9.1", + vue: "^3.4.21", + "vue-router": "4.3.2", + "vue-tsc": "^2.0.6" + } +}; + +// vite.config.ts +var __vite_injected_original_dirname = "/Users/bytedance/dev/universe/packages/bridge/vue3-bridge"; +var vite_config_default = defineConfig({ + plugins: [ + vue(), + dts({ + rollupTypes: true, + bundledPackages: ["@module-federation/bridge-shared"] + }), + vueJsx() + ], + build: { + lib: { + entry: path.resolve(__vite_injected_original_dirname, "src/index.ts"), + formats: ["cjs", "es"], + fileName: (format) => `index.${format}.js` + }, + rollupOptions: { + external: ["vue", "vue-router"] + } + }, + define: { + __APP_VERSION__: JSON.stringify(package_default.version) + } +}); +export { + vite_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiLCAicGFja2FnZS5qc29uIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZGlybmFtZSA9IFwiL1VzZXJzL2J5dGVkYW5jZS9kZXYvdW5pdmVyc2UvcGFja2FnZXMvYnJpZGdlL3Z1ZTMtYnJpZGdlXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ZpbGVuYW1lID0gXCIvVXNlcnMvYnl0ZWRhbmNlL2Rldi91bml2ZXJzZS9wYWNrYWdlcy9icmlkZ2UvdnVlMy1icmlkZ2Uvdml0ZS5jb25maWcudHNcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfaW1wb3J0X21ldGFfdXJsID0gXCJmaWxlOi8vL1VzZXJzL2J5dGVkYW5jZS9kZXYvdW5pdmVyc2UvcGFja2FnZXMvYnJpZGdlL3Z1ZTMtYnJpZGdlL3ZpdGUuY29uZmlnLnRzXCI7aW1wb3J0IHsgZGVmaW5lQ29uZmlnIH0gZnJvbSAndml0ZSc7XG5pbXBvcnQgdnVlIGZyb20gJ0B2aXRlanMvcGx1Z2luLXZ1ZSc7XG5pbXBvcnQgcGF0aCBmcm9tICdwYXRoJztcbmltcG9ydCBkdHMgZnJvbSAndml0ZS1wbHVnaW4tZHRzJztcbmltcG9ydCB2dWVKc3ggZnJvbSAnQHZpdGVqcy9wbHVnaW4tdnVlLWpzeCc7XG5pbXBvcnQgcGFja2FnZUpzb24gZnJvbSAnLi9wYWNrYW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NiO0FBQ0Y7OztBRDdDQSxJQUFNLG1DQUFtQztBQU96QyxJQUFPLHNCQUFRLGFBQWE7QUFBQSxFQUMxQixTQUFTO0FBQUEsSUFDUCxJQUFJO0FBQUEsSUFDSixJQUFJO0FBQUEsTUFDRixhQUFhO0FBQUEsTUFDYixpQkFBaUIsQ0FBQyxrQ0FBa0M7QUFBQSxJQUN0RCxDQUFDO0FBQUEsSUFDRCxPQUFPO0FBQUEsRUFDVDtBQUFBLEVBQ0EsT0FBTztBQUFBLElBQ0wsS0FBSztBQUFBLE1BQ0gsT0FBTyxLQUFLLFFBQVEsa0NBQVcsY0FBYztBQUFBLE1BQzdDLFNBQVMsQ0FBQyxPQUFPLElBQUk7QUFBQSxNQUNyQixVQUFVLENBQUMsV0FBVyxTQUFTLE1BQU07QUFBQSxJQUN2QztBQUFBLElBQ0EsZUFBZTtBQUFBLE1BQ2IsVUFBVSxDQUFDLE9BQU8sWUFBWTtBQUFBLElBQ2hDO0FBQUEsRUFDRjtBQUFBLEVBQ0EsUUFBUTtBQUFBLElBQ04saUJBQWlCLEtBQUssVUFBVSxnQkFBWSxPQUFPO0FBQUEsRUFDckQ7QUFDRixDQUFDOyIsCiAgIm5hbWVzIjogW10KfQo= diff --git a/packages/enhanced/src/lib/sharing/ConsumeSharedRuntimeModule.ts b/packages/enhanced/src/lib/sharing/ConsumeSharedRuntimeModule.ts index 0ed0842722..d25910a885 100644 --- a/packages/enhanced/src/lib/sharing/ConsumeSharedRuntimeModule.ts +++ b/packages/enhanced/src/lib/sharing/ConsumeSharedRuntimeModule.ts @@ -7,6 +7,7 @@ import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-p import type { Module, ChunkGraph, Compilation, Chunk } from 'webpack'; import ConsumeSharedModule from './ConsumeSharedModule'; import { getFederationGlobalScope } from '../container/runtime/utils'; +import ContainerEntryModule from '../container/ContainerEntryModule'; const { Template, RuntimeGlobals, RuntimeModule } = require( normalizeWebpackPath('webpack'), @@ -92,15 +93,21 @@ class ConsumeSharedRuntimeModule extends RuntimeModule { moduleIdToSourceMapping.set(id, sharedInfoAndHandlerStr); } }; - // const chunkReferences = this._runtimeRequirements.has( - // 'federation-entry-startup', - // ) - // ? this.chunk?.getAllReferencedChunks() - // : this.chunk?.getAllAsyncChunks(); - // - // const allChunks = chunkReferences || []; - const allChunks = [...(this.chunk?.getAllReferencedChunks() || [])]; - for (const chunk of allChunks) { + let chunkReferences; + if (this.chunkGraph && this.chunk) { + const entryMods = Array.from( + this.chunkGraph.getChunkEntryModulesIterable(this.chunk), + ); + const isRemoteEntry = entryMods.some( + (m) => m instanceof ContainerEntryModule, + ); + if (isRemoteEntry) { + chunkReferences = this.chunk?.getAllAsyncChunks(); + } else { + chunkReferences = this.chunk.getAllReferencedChunks(); + } + } + for (const chunk of chunkReferences || []) { const modules = chunkGraph.getChunkModulesIterableBySourceType( chunk, 'consume-shared', From b314d42042a1bd6c3e93b533be0c75a0415b10ac Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Fri, 30 Aug 2024 18:58:14 -0700 Subject: [PATCH 02/17] perf: reduce chunk map if remote entry chunk --- ....timestamp-1725065688311-ff3d0baa61437.mjs | 133 ------------------ ....timestamp-1725065688435-91ac119551b5d.mjs | 84 ----------- 2 files changed, 217 deletions(-) delete mode 100644 packages/bridge/bridge-react/vite.config.ts.timestamp-1725065688311-ff3d0baa61437.mjs delete mode 100644 packages/bridge/vue3-bridge/vite.config.ts.timestamp-1725065688435-91ac119551b5d.mjs diff --git a/packages/bridge/bridge-react/vite.config.ts.timestamp-1725065688311-ff3d0baa61437.mjs b/packages/bridge/bridge-react/vite.config.ts.timestamp-1725065688311-ff3d0baa61437.mjs deleted file mode 100644 index 3ab63c7c9f..0000000000 --- a/packages/bridge/bridge-react/vite.config.ts.timestamp-1725065688311-ff3d0baa61437.mjs +++ /dev/null @@ -1,133 +0,0 @@ -// vite.config.ts -import { defineConfig } from "file:///Users/bytedance/dev/universe/node_modules/.pnpm/vite@5.2.11_@types+node@18.16.9_less@4.2.0_stylus@0.63.0/node_modules/vite/dist/node/index.js"; -import path from "path"; -import dts from "file:///Users/bytedance/dev/universe/node_modules/.pnpm/vite-plugin-dts@3.9.1_@types+node@18.16.9_rollup@4.19.0_typescript@5.5.2_vite@5.2.11/node_modules/vite-plugin-dts/dist/index.mjs"; - -// package.json -var package_default = { - name: "@module-federation/bridge-react", - version: "0.6.0", - publishConfig: { - access: "public" - }, - author: "zhouxiao ", - type: "module", - main: "./dist/index.cjs.js", - module: "./dist/index.es.js", - types: "./dist/index.d.ts", - exports: { - ".": { - types: "./dist/index.d.ts", - import: "./dist/index.es.js", - require: "./dist/index.cjs.js" - }, - "./router": { - types: "./dist/router.d.ts", - import: "./dist/router.es.js", - require: "./dist/router.cjs.js" - }, - "./router-v5": { - types: "./dist/router-v5.d.ts", - import: "./dist/router-v5.es.js", - require: "./dist/router-v5.cjs.js" - }, - "./router-v6": { - types: "./dist/router-v6.d.ts", - import: "./dist/router-v6.es.js", - require: "./dist/router-v6.cjs.js" - }, - "./*": "./*" - }, - scripts: { - dev: "vite", - build: "vite build", - preview: "vite preview" - }, - dependencies: { - "@loadable/component": "^5.16.4", - "@module-federation/bridge-shared": "workspace:*", - "react-error-boundary": "^4.0.13" - }, - peerDependencies: { - react: ">=16.9.0", - "react-dom": ">=16.9.0", - "react-router-dom": ">=4" - }, - devDependencies: { - "@testing-library/react": "15.0.7", - "@types/react": "18.2.79", - "@types/react-dom": "18.2.25", - "@vitejs/plugin-react": "^4.3.0", - "@vitejs/plugin-vue": "^5.0.4", - "@vitejs/plugin-vue-jsx": "^4.0.0", - jsdom: "^24.1.0", - react: "18.1.0", - "react-dom": "18.1.0", - "react-router-dom": "6.22.3", - typescript: "^5.2.2", - vite: "^5.2.0", - "vite-plugin-dts": "^3.9.1" - } -}; - -// vite.config.ts -var __vite_injected_original_dirname = "/Users/bytedance/dev/universe/packages/bridge/bridge-react"; -var perDepsKeys = Object.keys(package_default.peerDependencies); -var vite_config_default = defineConfig({ - plugins: [ - dts({ - rollupTypes: true, - bundledPackages: [ - "@module-federation/bridge-shared", - "react-error-boundary" - ] - }) - ], - build: { - lib: { - entry: { - index: path.resolve(__vite_injected_original_dirname, "src/index.ts"), - router: path.resolve(__vite_injected_original_dirname, "src/router.tsx"), - "router-v5": path.resolve(__vite_injected_original_dirname, "src/router-v5.tsx"), - "router-v6": path.resolve(__vite_injected_original_dirname, "src/router-v6.tsx") - }, - formats: ["cjs", "es"], - fileName: (format, entryName) => `${entryName}.${format}.js` - }, - rollupOptions: { - external: [ - ...perDepsKeys, - "@remix-run/router", - "react-router", - "react-router-dom/", - "react-router-dom/index.js", - "react-router-dom/dist/index.js" - ], - plugins: [ - { - name: "modify-output-plugin", - generateBundle(options, bundle) { - for (const fileName in bundle) { - const chunk = bundle[fileName]; - if (fileName.includes("router-v5") && chunk.type === "chunk") { - chunk.code = chunk.code.replace( - // Match 'react-router-dom/' followed by single quotes, double quotes, or backticks, replacing only 'react-router-dom/' to react-router-v5 dist file structure - /react-router-dom\/(?=[\'\"\`])/g, - "react-router-dom/index.js" - ); - } - } - } - } - ] - }, - minify: false - }, - define: { - __APP_VERSION__: JSON.stringify(package_default.version) - } -}); -export { - vite_config_default as default -}; -//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiLCAicGFja2FnZS5qc29uIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZGlybmFtZSA9IFwiL1VzZXJzL2J5dGVkYW5jZS9kZXYvdW5pdmVyc2UvcGFja2FnZXMvYnJpZGdlL2JyaWRnZS1yZWFjdFwiO2NvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9maWxlbmFtZSA9IFwiL1VzZXJzL2J5dGVkYW5jZS9kZXYvdW5pdmVyc2UvcGFja2FnZXMvYnJpZGdlL2JyaWRnZS1yZW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BLFVBQ0Y7QUFBQSxRQUNGO0FBQUEsTUFDRjtBQUFBLElBQ0Y7QUFBQSxJQUNBLFFBQVE7QUFBQSxFQUNWO0FBQUEsRUFDQSxRQUFRO0FBQUEsSUFDTixpQkFBaUIsS0FBSyxVQUFVLGdCQUFZLE9BQU87QUFBQSxFQUNyRDtBQUNGLENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg== diff --git a/packages/bridge/vue3-bridge/vite.config.ts.timestamp-1725065688435-91ac119551b5d.mjs b/packages/bridge/vue3-bridge/vite.config.ts.timestamp-1725065688435-91ac119551b5d.mjs deleted file mode 100644 index 257a01c8bf..0000000000 --- a/packages/bridge/vue3-bridge/vite.config.ts.timestamp-1725065688435-91ac119551b5d.mjs +++ /dev/null @@ -1,84 +0,0 @@ -// vite.config.ts -import { defineConfig } from "file:///Users/bytedance/dev/universe/node_modules/.pnpm/vite@5.2.11_@types+node@18.16.9_less@4.2.0_stylus@0.63.0/node_modules/vite/dist/node/index.js"; -import vue from "file:///Users/bytedance/dev/universe/node_modules/.pnpm/@vitejs+plugin-vue@5.1.0_vite@5.2.11_vue@3.4.34/node_modules/@vitejs/plugin-vue/dist/index.mjs"; -import path from "path"; -import dts from "file:///Users/bytedance/dev/universe/node_modules/.pnpm/vite-plugin-dts@3.9.1_@types+node@18.16.9_rollup@4.19.0_typescript@5.5.2_vite@5.2.11/node_modules/vite-plugin-dts/dist/index.mjs"; -import vueJsx from "file:///Users/bytedance/dev/universe/node_modules/.pnpm/@vitejs+plugin-vue-jsx@4.0.0_vite@5.2.11_vue@3.4.34/node_modules/@vitejs/plugin-vue-jsx/dist/index.mjs"; - -// package.json -var package_default = { - name: "@module-federation/bridge-vue3", - author: "zhouxiao ", - version: "0.6.0", - publishConfig: { - access: "public" - }, - type: "module", - main: "./dist/index.cjs.js", - module: "./dist/index.es.js", - types: "./dist/index.d.ts", - files: [ - "dist/", - "src/", - "CHANGELOG.md", - "LICENSE", - "package.json", - "project.json", - "README.md", - "tsconfig.json", - "tsconfig.node.json", - "vite.config.ts" - ], - scripts: { - dev: "vite", - build: "vite build", - preview: "vite preview" - }, - peerDependencies: { - vue: "=3", - "vue-router": "=3" - }, - dependencies: { - "@module-federation/bridge-shared": "workspace:*" - }, - devDependencies: { - "@vitejs/plugin-vue": "^5.0.4", - "@vitejs/plugin-vue-jsx": "^4.0.0", - typescript: "^5.2.2", - vite: "^5.2.0", - "vite-plugin-dts": "^3.9.1", - vue: "^3.4.21", - "vue-router": "4.3.2", - "vue-tsc": "^2.0.6" - } -}; - -// vite.config.ts -var __vite_injected_original_dirname = "/Users/bytedance/dev/universe/packages/bridge/vue3-bridge"; -var vite_config_default = defineConfig({ - plugins: [ - vue(), - dts({ - rollupTypes: true, - bundledPackages: ["@module-federation/bridge-shared"] - }), - vueJsx() - ], - build: { - lib: { - entry: path.resolve(__vite_injected_original_dirname, "src/index.ts"), - formats: ["cjs", "es"], - fileName: (format) => `index.${format}.js` - }, - rollupOptions: { - external: ["vue", "vue-router"] - } - }, - define: { - __APP_VERSION__: JSON.stringify(package_default.version) - } -}); -export { - vite_config_default as default -}; -//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiLCAicGFja2FnZS5qc29uIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZGlybmFtZSA9IFwiL1VzZXJzL2J5dGVkYW5jZS9kZXYvdW5pdmVyc2UvcGFja2FnZXMvYnJpZGdlL3Z1ZTMtYnJpZGdlXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ZpbGVuYW1lID0gXCIvVXNlcnMvYnl0ZWRhbmNlL2Rldi91bml2ZXJzZS9wYWNrYWdlcy9icmlkZ2UvdnVlMy1icmlkZ2Uvdml0ZS5jb25maWcudHNcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfa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OyIsCiAgIm5hbWVzIjogW10KfQo= From 7c60d1f0f778754fc9f3158a95eb8aa54aad9cf9 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Fri, 30 Aug 2024 19:09:01 -0700 Subject: [PATCH 03/17] perf: reduce chunk map if remote entry chunk --- .../src/lib/container/RemoteRuntimeModule.ts | 21 ++++++++++++++----- .../lib/sharing/ConsumeSharedRuntimeModule.ts | 14 ++++++------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/packages/enhanced/src/lib/container/RemoteRuntimeModule.ts b/packages/enhanced/src/lib/container/RemoteRuntimeModule.ts index 14005344c1..2671e97e12 100644 --- a/packages/enhanced/src/lib/container/RemoteRuntimeModule.ts +++ b/packages/enhanced/src/lib/container/RemoteRuntimeModule.ts @@ -10,6 +10,7 @@ import type ExternalModule from 'webpack/lib/ExternalModule'; import type FallbackModule from './FallbackModule'; import type { RemotesOptions } from '@module-federation/webpack-bundler-runtime'; import { FEDERATION_SUPPORTED_TYPES } from '@module-federation/webpack-bundler-runtime/constant'; +import ContainerEntryModule from './ContainerEntryModule'; const extractUrlAndGlobal = require( normalizeWebpackPath('webpack/lib/util/extractUrlAndGlobal'), @@ -44,12 +45,22 @@ class RemoteRuntimeModule extends RuntimeModule { // chunkReferences = this.chunk.getAllAsyncChunks(); // } // } + let chunkReferences; + if (this.chunkGraph && this.chunk) { + const entryMods = Array.from( + this.chunkGraph.getChunkEntryModulesIterable(this.chunk), + ); + const isRemoteEntry = entryMods.some( + (m) => m instanceof ContainerEntryModule, + ); + chunkReferences = isRemoteEntry + ? this.chunk.getAllAsyncChunks() + : this.chunk.getAllReferencedChunks(); + } else { + chunkReferences = this.chunk?.getAllReferencedChunks() || []; + } - const allChunks = [ - ...Array.from(this.chunk?.getAllReferencedChunks() || []), - ]; - - for (const chunk of allChunks) { + for (const chunk of chunkReferences) { const modules = chunkGraph?.getChunkModulesIterableBySourceType( chunk, 'remote', diff --git a/packages/enhanced/src/lib/sharing/ConsumeSharedRuntimeModule.ts b/packages/enhanced/src/lib/sharing/ConsumeSharedRuntimeModule.ts index d25910a885..500173556d 100644 --- a/packages/enhanced/src/lib/sharing/ConsumeSharedRuntimeModule.ts +++ b/packages/enhanced/src/lib/sharing/ConsumeSharedRuntimeModule.ts @@ -101,13 +101,13 @@ class ConsumeSharedRuntimeModule extends RuntimeModule { const isRemoteEntry = entryMods.some( (m) => m instanceof ContainerEntryModule, ); - if (isRemoteEntry) { - chunkReferences = this.chunk?.getAllAsyncChunks(); - } else { - chunkReferences = this.chunk.getAllReferencedChunks(); - } + chunkReferences = isRemoteEntry + ? this.chunk.getAllAsyncChunks() + : this.chunk.getAllReferencedChunks(); + } else { + chunkReferences = this.chunk?.getAllReferencedChunks() || []; } - for (const chunk of chunkReferences || []) { + for (const chunk of chunkReferences) { const modules = chunkGraph.getChunkModulesIterableBySourceType( chunk, 'consume-shared', @@ -123,7 +123,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule { (chunkToModuleMapping[chunk.id.toString()] = []), ); } - for (const chunk of [...(this.chunk?.getAllInitialChunks() || [])]) { + for (const chunk of this.chunk?.getAllInitialChunks() || []) { const modules = chunkGraph.getChunkModulesIterableBySourceType( chunk, 'consume-shared', From 93d6502c54b65cfe4a72c92a597ca235ab664274 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Fri, 30 Aug 2024 19:20:25 -0700 Subject: [PATCH 04/17] chore: use non vendored runtime to test --- .../src/lib/container/runtime/FederationRuntimePlugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts index 40ae647a95..f627dd9f1d 100644 --- a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts +++ b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts @@ -389,7 +389,7 @@ class FederationRuntimePlugin { if (this.options?.implementation) { const runtimePath = this.options.embedRuntime - ? '@module-federation/webpack-bundler-runtime/vendor' + ? '@module-federation/webpack-bundler-runtime' : '@module-federation/webpack-bundler-runtime'; this.bundlerRuntimePath = require.resolve(runtimePath, { paths: [this.options.implementation], From 56bd582171940e3f5f902942a0ecd24a1e58e37f Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Fri, 30 Aug 2024 19:21:08 -0700 Subject: [PATCH 05/17] chore: use non vendored runtime to test --- .../src/lib/container/runtime/FederationRuntimePlugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts index f627dd9f1d..78d8bac650 100644 --- a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts +++ b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts @@ -39,7 +39,7 @@ const BundlerRuntimePath = require.resolve( ); const VendoredBundlerRuntimePath = require.resolve( - '@module-federation/webpack-bundler-runtime/vendor', + '@module-federation/webpack-bundler-runtime', { paths: [RuntimeToolsPath], }, From 472288f50c28988c627fbf385af9745f4c0ec516 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Fri, 30 Aug 2024 21:03:10 -0700 Subject: [PATCH 06/17] fix: use normal module replacement for bundler runtime import --- .../runtime/FederationRuntimePlugin.ts | 13 +++++++++++++ webpack/types.d.ts | 19 +------------------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts index 78d8bac650..86f7383fb4 100644 --- a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts +++ b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts @@ -409,6 +409,19 @@ class FederationRuntimePlugin { this.getFilePath(), this.bundlerRuntimePath, ).apply(compiler); + + new compiler.webpack.NormalModuleReplacementPlugin( + /@module-federation\/runtime/, + (resolveData) => { + if (/webpack-bundler-runtime/.test(resolveData.contextInfo.issuer)) { + resolveData.request = RuntimePath.replace('cjs', 'esm'); + + if (resolveData.createData) { + resolveData.createData.request = resolveData.request; + } + } + }, + ).apply(compiler); } this.prependEntry(compiler); this.injectRuntime(compiler); diff --git a/webpack/types.d.ts b/webpack/types.d.ts index 986bf72e69..3e64eed797 100644 --- a/webpack/types.d.ts +++ b/webpack/types.d.ts @@ -5,6 +5,7 @@ */ import Compilation from './lib/Compilation'; import Stats from './lib/Stats'; +import NormalModuleReplacementPlugin from './lib/NormalModuleReplacementPlugin'; import MultiCompiler from './lib/MultiCompiler'; import Parser from './lib/Parser'; import ModuleDependency from './lib/dependencies/ModuleDependency'; @@ -3178,24 +3179,6 @@ declare interface NormalModuleLoaderContext { _compiler?: Compiler; } -declare class NormalModuleReplacementPlugin { - /** - * Create an instance of the plugin - */ - constructor( - resourceRegExp: RegExp, - newResource: string | ((arg0: ResolveData) => void), - ); - - resourceRegExp: RegExp; - newResource: string | ((arg0: ResolveData) => void); - - /** - * Apply the plugin - */ - apply(compiler: Compiler): void; -} - declare class NullDependency extends Dependency { constructor(); From 23e818abcec501610400378e1a5c840624b199a2 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Fri, 30 Aug 2024 22:01:33 -0700 Subject: [PATCH 07/17] chore: use esm for runtime resolve paths --- .../src/lib/container/runtime/FederationRuntimePlugin.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts index 86f7383fb4..2dd0c2ccb9 100644 --- a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts +++ b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts @@ -325,6 +325,7 @@ class FederationRuntimePlugin { }; if (this.options?.embedRuntime) { + runtimePath = runtimePath.replace('.cjs', '.esm'); // should use normal module replacement instead? if (!compiler.options.resolve.alias['@module-federation/runtime$']) { compiler.options.resolve.alias['@module-federation/runtime$'] = @@ -389,7 +390,7 @@ class FederationRuntimePlugin { if (this.options?.implementation) { const runtimePath = this.options.embedRuntime - ? '@module-federation/webpack-bundler-runtime' + ? '@module-federation/webpack-bundler-runtime/vendor' : '@module-federation/webpack-bundler-runtime'; this.bundlerRuntimePath = require.resolve(runtimePath, { paths: [this.options.implementation], From f9e146d240a5ca91a01a26361da005404520d409 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Fri, 30 Aug 2024 22:11:30 -0700 Subject: [PATCH 08/17] chore: use esm for runtime resolve paths --- .../src/lib/container/runtime/FederationRuntimePlugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts index 2dd0c2ccb9..23e402b0c2 100644 --- a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts +++ b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts @@ -390,7 +390,7 @@ class FederationRuntimePlugin { if (this.options?.implementation) { const runtimePath = this.options.embedRuntime - ? '@module-federation/webpack-bundler-runtime/vendor' + ? '@module-federation/webpack-bundler-runtime' : '@module-federation/webpack-bundler-runtime'; this.bundlerRuntimePath = require.resolve(runtimePath, { paths: [this.options.implementation], From ed8b69a3c158edf06e354355688051772978c3f3 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Fri, 30 Aug 2024 23:53:28 -0700 Subject: [PATCH 09/17] chore: use esm for runtime resolve paths --- .../src/lib/container/runtime/FederationRuntimePlugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts index 23e402b0c2..f9ba0c5298 100644 --- a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts +++ b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts @@ -119,7 +119,7 @@ class FederationRuntimePlugin { return Template.asString([ `import federation from '${normalizedBundlerRuntimePath}';`, runtimePluginTemplates, - embedRuntime ? '' : embedRuntimeLines, + embedRuntimeLines, `if(!${federationGlobal}.instance){`, Template.indent([ runtimePluginNames.length From fbb7f1e9f5ed912fdad1ebf4d38728d12a145fe8 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Fri, 30 Aug 2024 23:56:19 -0700 Subject: [PATCH 10/17] chore: use esm for runtime resolve paths --- apps/3000-home/cypress/e2e/app.cy.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/3000-home/cypress/e2e/app.cy.ts b/apps/3000-home/cypress/e2e/app.cy.ts index 92008de438..5028051cb2 100644 --- a/apps/3000-home/cypress/e2e/app.cy.ts +++ b/apps/3000-home/cypress/e2e/app.cy.ts @@ -23,9 +23,8 @@ describe('3000-home/', () => { getH1().contains('This is SPA combined'); }); it('Api endpoint works', () => { - const urls = ['/api/test']; - urls.forEach((url) => { - cy.request(url); // This makes a GET request, not a full page visit + cy.request('/api/test').then((response) => { + expect(response.headers['content-type']).to.include('application/json'); }); }); }); From 828daa284a097b95f5c8d726bc9f81741b0ff5c4 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Fri, 30 Aug 2024 23:58:56 -0700 Subject: [PATCH 11/17] chore: use esm for runtime resolve paths --- apps/3000-home/cypress/e2e/app.cy.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/3000-home/cypress/e2e/app.cy.ts b/apps/3000-home/cypress/e2e/app.cy.ts index 5028051cb2..5dda8279f2 100644 --- a/apps/3000-home/cypress/e2e/app.cy.ts +++ b/apps/3000-home/cypress/e2e/app.cy.ts @@ -22,7 +22,10 @@ describe('3000-home/', () => { it('should display welcome message', () => { getH1().contains('This is SPA combined'); }); - it('Api endpoint works', () => { + }); + + describe('API endpoint should return json', () => { + it('Query Endpoint', () => { cy.request('/api/test').then((response) => { expect(response.headers['content-type']).to.include('application/json'); }); From e82390482d54280d24466d158a45d93ec784f72e Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Sat, 31 Aug 2024 23:17:49 -0700 Subject: [PATCH 12/17] fix: set used exports for all --- .../HoistContainerReferencesPlugin.ts | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts b/packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts index 24666a599f..f7746f23b0 100644 --- a/packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts +++ b/packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts @@ -87,15 +87,22 @@ export class HoistContainerReferences implements WebpackPluginInstance { module instanceof NormalModule && module.resource === this.bundlerRuntimeDep ) { - const exportsInfo: ExportsInfo = - moduleGraph.getExportsInfo(module); - //Since i dont use the import federation var, tree shake will eliminate it. - exportsInfo.setUsedInUnknownWay(runtime); - moduleGraph.addExtraReason(module, this.explanation); - if (module.factoryMeta === undefined) { - module.factoryMeta = {}; + const allRefs = this.getAllReferencedModules( + compilation, + module, + 'initial', + ); + for (const module of allRefs) { + const exportsInfo: ExportsInfo = + moduleGraph.getExportsInfo(module); + //Since i dont use the import federation var, tree shake will eliminate it. + exportsInfo.setUsedInUnknownWay(runtime); + moduleGraph.addExtraReason(module, this.explanation); + if (module.factoryMeta === undefined) { + module.factoryMeta = {}; + } + module.factoryMeta.sideEffectFree = false; } - module.factoryMeta.sideEffectFree = false; } } } From 9a9f707a22c2ed96283940f4f1ef95edce0a4964 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Sun, 1 Sep 2024 21:44:05 -0700 Subject: [PATCH 13/17] fix: set used exports for all --- .../src/lib/container/HoistContainerReferencesPlugin.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts b/packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts index f7746f23b0..41ebd22ed2 100644 --- a/packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts +++ b/packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts @@ -19,6 +19,7 @@ const ConcatenatedModule = require( ) as typeof import('webpack/lib/optimize/ConcatenatedModule'); const PLUGIN_NAME = 'HoistContainerReferences'; + /** * This class is used to hoist container references in the code. * @constructor @@ -67,7 +68,7 @@ export class HoistContainerReferences implements WebpackPluginInstance { ); // Hook into the optimizeDependencies phase - compilation.hooks.optimizeDependencies.tap( + compilation.hooks.afterOptimizeDependencies.tap( PLUGIN_NAME, (modules: Iterable) => { if (this.entryFilePath) { @@ -95,7 +96,9 @@ export class HoistContainerReferences implements WebpackPluginInstance { for (const module of allRefs) { const exportsInfo: ExportsInfo = moduleGraph.getExportsInfo(module); - //Since i dont use the import federation var, tree shake will eliminate it. + // Since i dont use the import federation var, tree shake will eliminate it. + // also because currently the runtime is copied into all runtime chunks + // some might not have the runtime import in the tree to begin with exportsInfo.setUsedInUnknownWay(runtime); moduleGraph.addExtraReason(module, this.explanation); if (module.factoryMeta === undefined) { From 09129c1bb5e8099d3481dc8882197956a30fed75 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Sun, 1 Sep 2024 21:51:14 -0700 Subject: [PATCH 14/17] fix: set used exports for all --- .../src/lib/container/HoistContainerReferencesPlugin.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts b/packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts index 41ebd22ed2..a3f9178d01 100644 --- a/packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts +++ b/packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts @@ -68,8 +68,12 @@ export class HoistContainerReferences implements WebpackPluginInstance { ); // Hook into the optimizeDependencies phase - compilation.hooks.afterOptimizeDependencies.tap( - PLUGIN_NAME, + compilation.hooks.optimizeDependencies.tap( + { + name: PLUGIN_NAME, + // basic optimization stage - it runs first + stage: -10, + }, (modules: Iterable) => { if (this.entryFilePath) { let runtime: RuntimeSpec | undefined; From e64f7ed97b45a89b1b78398a3a7d28e14458e96b Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Mon, 2 Sep 2024 14:04:52 -0700 Subject: [PATCH 15/17] fix: set used exports for all --- .../src/lib/container/runtime/FederationRuntimePlugin.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts index f9ba0c5298..263a3b224f 100644 --- a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts +++ b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts @@ -247,6 +247,11 @@ class FederationRuntimePlugin { RuntimeGlobals || ({} as typeof RuntimeGlobals), ); + compiler.hooks.entryOption.tap(this.constructor.name, (options, entry) => { + debugger; + return true; + }); + compiler.hooks.thisCompilation.tap( this.constructor.name, (compilation: Compilation, { normalModuleFactory }) => { From bbe75203039b083c3709062a3f38a77f4aeedb00 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Mon, 2 Sep 2024 14:38:56 -0700 Subject: [PATCH 16/17] fix(enhanced): do not use embedded bundler runtime --- .../src/lib/container/runtime/FederationRuntimePlugin.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts index 88c9894290..ae0fb55b5c 100644 --- a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts +++ b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts @@ -233,11 +233,6 @@ class FederationRuntimePlugin { RuntimeGlobals || ({} as typeof RuntimeGlobals), ); - compiler.hooks.entryOption.tap(this.constructor.name, (options, entry) => { - debugger; - return true; - }); - compiler.hooks.thisCompilation.tap( this.constructor.name, (compilation: Compilation, { normalModuleFactory }) => { From 235f9cc8283394c334ced25359db0f88c237be12 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Wed, 4 Sep 2024 17:44:28 -0700 Subject: [PATCH 17/17] chore: docs --- .../src/lib/container/runtime/FederationRuntimePlugin.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts index 111febcf89..803f2d6557 100644 --- a/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts +++ b/packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts @@ -313,10 +313,6 @@ class FederationRuntimePlugin { ...compiler.options.resolve.alias, }; - if (this.options?.embedRuntime) { - runtimePath = runtimePath.replace('.cjs', '.esm'); - } - if (!compiler.options.resolve.alias['@module-federation/runtime$']) { compiler.options.resolve.alias['@module-federation/runtime$'] = runtimePath;