@gravity-ui/app-builder 0.30.1 → 0.30.3

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/README.md CHANGED
@@ -340,6 +340,7 @@ Module Federation is a Webpack 5 feature that enables micro-frontend architectur
340
340
  - `moduleFederation` (`object`) — Module Federation configuration
341
341
  - `name` (`string`) — unique name of the application in the Module Federation ecosystem. Required parameter.
342
342
  - `version` (`string`) — application version. When specified, the entry file will be named `entry-{version}.js` instead of `entry.js`.
343
+ - `disableManifest` (`boolean`) — disable manifest file generation. When `true`, uses regular `.js` files for remote entry instead of manifest files. Default is `false`.
343
344
  - `publicPath` (`string`) — base URL for loading resources of this micro-frontend. Required parameter.
344
345
  - `remotes` (`string[]`) — list of remote application names that this application can load. Simplified alternative to `originalRemotes`.
345
346
  - `originalRemotes` (`RemotesObject`) — full configuration of remote applications in Module Federation Plugin format.
@@ -49,6 +49,9 @@ async function default_1(config) {
49
49
  logger_1.default.warning(`Failed to remove appRun path [${appRunPath}]: ${error}`);
50
50
  }
51
51
  }
52
+ if (shouldCompileClient || shouldCompileServer) {
53
+ (0, utils_1.createRunFolder)(config);
54
+ }
52
55
  let clientCompiled = !shouldCompileClient;
53
56
  let serverCompiled = !shouldCompileServer;
54
57
  let needToStartNodemon = shouldCompileServer;
@@ -30,7 +30,6 @@ exports.watchServerCompilation = watchServerCompilation;
30
30
  const path = __importStar(require("node:path"));
31
31
  const rimraf_1 = require("rimraf");
32
32
  const controllable_script_1 = require("../../common/child-process/controllable-script");
33
- const utils_1 = require("../../common/utils");
34
33
  const paths_1 = __importDefault(require("../../common/paths"));
35
34
  function createTypescriptBuildScript(config) {
36
35
  return `
@@ -79,7 +78,6 @@ watch(
79
78
  async function watchServerCompilation(config) {
80
79
  const serverPath = path.resolve(paths_1.default.appDist, 'server');
81
80
  rimraf_1.rimraf.sync(serverPath);
82
- (0, utils_1.createRunFolder)(config);
83
81
  const build = new controllable_script_1.ControllableScript(config.server.compiler === 'swc'
84
82
  ? createSWCBuildScript(config)
85
83
  : createTypescriptBuildScript(config), null);
@@ -72,6 +72,11 @@ export type ModuleFederationConfig = Omit<moduleFederationPlugin.ModuleFederatio
72
72
  * @default undefined (file will be named `entry.js`)
73
73
  */
74
74
  version?: string;
75
+ /**
76
+ * Disable manifest file generation
77
+ * @default false
78
+ */
79
+ disableManifest?: boolean;
75
80
  /**
76
81
  * Base URL for loading resources of this micro-frontend
77
82
  * Should point to a publicly accessible URL where the files will be hosted
@@ -310,12 +310,15 @@ function configureRspackExperiments(options) {
310
310
  const filesystemCacheOptions = typeof config.cache === 'object' && config.cache.type === 'filesystem'
311
311
  ? config.cache
312
312
  : undefined;
313
- const version = [filesystemCacheOptions?.name, filesystemCacheOptions?.version]
313
+ const cacheVersion = [
314
+ config.moduleFederation?.name || filesystemCacheOptions?.name,
315
+ config.moduleFederation?.version || filesystemCacheOptions?.version,
316
+ ]
314
317
  .filter(Boolean)
315
318
  .join('-');
316
319
  return {
317
320
  cache: {
318
- version: version || undefined,
321
+ version: cacheVersion || undefined,
319
322
  type: 'persistent',
320
323
  snapshot: {
321
324
  managedPaths: config.watchOptions?.watchPackages ? [] : undefined,
@@ -962,16 +965,27 @@ function configureCommonPlugins(options, bundlerPlugins) {
962
965
  }
963
966
  plugins.push(createMomentTimezoneDataPlugin(config.momentTz));
964
967
  if (config.moduleFederation) {
965
- const { name, version, publicPath, remotes, originalRemotes, remotesRuntimeVersioning, runtimePlugins, ...restOptions } = config.moduleFederation;
968
+ const { name, version, disableManifest, publicPath, remotes, originalRemotes, remotesRuntimeVersioning, runtimePlugins, ...restOptions } = config.moduleFederation;
966
969
  let actualRemotes = originalRemotes;
967
970
  if (remotes) {
971
+ let remoteFile;
972
+ if (disableManifest) {
973
+ if (remotesRuntimeVersioning) {
974
+ remoteFile = `entry-[version].js`;
975
+ }
976
+ else {
977
+ remoteFile = 'entry.js';
978
+ }
979
+ }
980
+ else if (remotesRuntimeVersioning) {
981
+ remoteFile = `mf-manifest-[version].json`;
982
+ }
983
+ else {
984
+ remoteFile = 'mf-manifest.json';
985
+ }
968
986
  actualRemotes = remotes.reduce((acc, remoteName) => {
969
- const remoteFilename = remotesRuntimeVersioning
970
- ? 'entry-[version].js'
971
- : 'entry.js';
972
987
  // eslint-disable-next-line no-param-reassign
973
- acc[remoteName] =
974
- `${remoteName}@${publicPath}${remoteName}/${remoteFilename}`;
988
+ acc[remoteName] = `${remoteName}@${publicPath}${remoteName}/${remoteFile}`;
975
989
  return acc;
976
990
  }, {});
977
991
  }
@@ -982,6 +996,13 @@ function configureCommonPlugins(options, bundlerPlugins) {
982
996
  plugins.push(new bundlerPlugins.ModuleFederationPlugin({
983
997
  name,
984
998
  filename: version ? `entry-${version}.js` : 'entry.js',
999
+ manifest: disableManifest
1000
+ ? undefined
1001
+ : {
1002
+ fileName: version
1003
+ ? `mf-manifest-${version}.json`
1004
+ : 'mf-manifest.json',
1005
+ },
985
1006
  remotes: actualRemotes,
986
1007
  runtimePlugins: actualRuntimePlugins,
987
1008
  ...restOptions,
@@ -1161,7 +1182,7 @@ function configureOptimization(helperOptions) {
1161
1182
  }
1162
1183
  const optimization = {
1163
1184
  splitChunks: getOptimizationSplitChunks(helperOptions),
1164
- runtimeChunk: 'single',
1185
+ runtimeChunk: helperOptions.config.moduleFederation ? false : 'single',
1165
1186
  minimizer: [
1166
1187
  (compiler) => {
1167
1188
  // CssMinimizerWebpackPlugin works with MiniCSSExtractPlugin, so only relevant for production builds.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.30.1",
3
+ "version": "0.30.3",
4
4
  "description": "Develop and build your React client-server projects, powered by typescript and webpack",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",