@umijs/mfsu 4.0.0-beta.12 → 4.0.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dep/dep.js CHANGED
@@ -40,7 +40,7 @@ class Dep {
40
40
  this.file = opts.file;
41
41
  this.version = opts.version;
42
42
  this.cwd = opts.cwd;
43
- this.shortFile = this.file.replace(this.cwd, '$CWD$');
43
+ this.shortFile = this.file;
44
44
  this.normalizedFile = this.shortFile.replace(/\//g, '_').replace(/:/g, '_');
45
45
  this.filePath = `${constants_1.MF_VA_PREFIX}${this.normalizedFile}.js`;
46
46
  this.mfsu = opts.mfsu;
package/dist/mfsu.js CHANGED
@@ -70,13 +70,18 @@ class MFSU {
70
70
  opts.config.entry = entry;
71
71
  // plugins
72
72
  opts.config.plugins = opts.config.plugins || [];
73
+ // support publicPath auto
74
+ let publicPath = opts.config.output.publicPath;
75
+ if (publicPath === 'auto') {
76
+ publicPath = '/';
77
+ }
73
78
  opts.config.plugins.push(...[
74
79
  new webpack_virtual_modules_1.default(virtualModules),
75
80
  new this.opts.implementor.container.ModuleFederationPlugin({
76
81
  name: '__',
77
82
  remotes: {
78
83
  // TODO: support runtime public path
79
- [mfName]: `${mfName}@${opts.config.output.publicPath}${constants_1.REMOTE_FILE_FULL}`,
84
+ [mfName]: `${mfName}@${publicPath}${constants_1.REMOTE_FILE_FULL}`,
80
85
  },
81
86
  }),
82
87
  new buildDepPlugin_1.BuildDepPlugin({
@@ -126,7 +131,7 @@ class MFSU {
126
131
  }
127
132
  res.setHeader('content-type', (0, mrmime_1.lookup)((0, path_1.extname)(req.path)) || 'text/plain');
128
133
  const relativePath = req.path.replace(new RegExp(`^${publicPath}`), '/');
129
- const content = (0, fs_1.readFileSync)((0, path_1.join)(this.opts.tmpBase, relativePath), 'utf-8');
134
+ const content = (0, fs_1.readFileSync)((0, path_1.join)(this.opts.tmpBase, relativePath));
130
135
  res.send(content);
131
136
  });
132
137
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/mfsu",
3
- "version": "4.0.0-beta.12",
3
+ "version": "4.0.0-beta.13",
4
4
  "description": "@umijs/mfsu",
5
5
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/mfsu#readme",
6
6
  "bugs": "https://github.com/umijs/umi-next/issues",
@@ -21,9 +21,9 @@
21
21
  "dev": "pnpm build -- --watch"
22
22
  },
23
23
  "dependencies": {
24
- "@umijs/bundler-esbuild": "4.0.0-beta.12",
25
- "@umijs/bundler-utils": "4.0.0-beta.12",
26
- "@umijs/utils": "4.0.0-beta.12"
24
+ "@umijs/bundler-esbuild": "4.0.0-beta.13",
25
+ "@umijs/bundler-utils": "4.0.0-beta.13",
26
+ "@umijs/utils": "4.0.0-beta.13"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/express": "4.17.13",