瀏覽代碼

Share extensions that are not in resolutions.

@jtpio pointed out that extensions installed from npm are not added to resolutions, but they are top-level extensions that should be shared.
Jason Grout 4 年之前
父節點
當前提交
d17aca7a26
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      dev_mode/webpack.config.js

+ 8 - 2
dev_mode/webpack.config.js

@@ -160,12 +160,18 @@ function ignored(path) {
 // Set up module federation sharing config
 const shared = {};
 
+// Make sure any resolutions are shared
 for (let [key, requiredVersion] of Object.entries(package_data.resolutions)) {
-  // eager so that built-in extensions can be bundled together into just a few
-  // js files to load
   shared[key] = { requiredVersion };
 }
 
+// Add any extension packages that are not in resolutions (i.e., installed from npm)
+for (let pkg in extensionPackages) {
+  if (shared[pkg] === undefined) {
+    shared[pkg] = { requiredVersion: package_data.dependencies[pkg] };
+  }
+}
+
 // Add dependencies and sharedPackage config from extension packages if they
 // are not already in the shared config. This means that if there is a
 // conflict, the resolutions package version is the one that is shared.