@gravity-ui/app-builder 0.26.1 → 0.26.2-beta.0

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.
@@ -95,9 +95,21 @@ async function buildDevServer(config) {
95
95
  }));
96
96
  }
97
97
  }
98
+ // Rspack multicompiler dont work with lazy compilation.
99
+ // Pass a single config to avoid multicompiler when SSR disabled.
100
+ const compiler = bundler === 'rspack'
101
+ ? (0, core_1.rspack)(isSsr ? rspackConfigs : rspackConfigs[0])
102
+ : (0, webpack_1.default)(webpackConfigs);
98
103
  const staticFolder = path.resolve(paths_1.default.appDist, 'public');
99
104
  const options = {
100
105
  static: staticFolder,
106
+ setupMiddlewares(middlewares) {
107
+ if (config.client.lazyCompilation && bundler === 'rspack') {
108
+ const lazyCompilationMiddleware = core_1.rspack.experiments.lazyCompilationMiddleware(compiler, rspackConfigs[0]?.experiments?.lazyCompilation);
109
+ return [lazyCompilationMiddleware, ...middlewares];
110
+ }
111
+ return middlewares;
112
+ },
101
113
  devMiddleware: {
102
114
  publicPath,
103
115
  stats: 'errors-warnings',
@@ -172,14 +184,9 @@ async function buildDevServer(config) {
172
184
  options.proxy = proxy;
173
185
  let server;
174
186
  if (bundler === 'rspack') {
175
- // Rspack multicompiler dont work with lazy compilation.
176
- // Pass a single config to avoid multicompiler when SSR disabled.
177
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
178
- const compiler = (0, core_1.rspack)(isSsr ? rspackConfigs : rspackConfigs[0]);
179
187
  server = new dev_server_1.RspackDevServer(options, compiler);
180
188
  }
181
189
  else {
182
- const compiler = (0, webpack_1.default)(webpackConfigs);
183
190
  server = new webpack_dev_server_1.default(options, compiler);
184
191
  }
185
192
  try {
@@ -288,26 +288,14 @@ function configureRspackExperiments(options) {
288
288
  return undefined;
289
289
  }
290
290
  let lazyCompilation;
291
- let port;
292
291
  if (config.lazyCompilation) {
293
- if (typeof config.lazyCompilation === 'object') {
294
- port = config.lazyCompilation.port;
295
- }
296
292
  lazyCompilation = {
297
293
  // Lazy compilation works without problems only with lazy imports
298
294
  // See https://github.com/web-infra-dev/rspack/issues/8503
299
295
  entries: false,
300
296
  imports: true,
301
- backend: {
302
- client: require.resolve('./lazy-client.js'),
303
- ...(port
304
- ? {
305
- listen: {
306
- port,
307
- },
308
- }
309
- : {}),
310
- },
297
+ prefix: '/build/lazy-compilation-using-',
298
+ client: require.resolve('./lazy-client.js'),
311
299
  test(module) {
312
300
  // make sure that lazy-client.js won't be lazy compiled)
313
301
  return !module.nameForCondition()?.endsWith('lazy-client.js');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.26.1",
3
+ "version": "0.26.2-beta.0",
4
4
  "description": "Develop and build your React client-server projects, powered by typescript and webpack",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -70,11 +70,11 @@
70
70
  "@babel/runtime": "^7.26.0",
71
71
  "@okikio/sharedworker": "^1.0.7",
72
72
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
73
- "@rsdoctor/rspack-plugin": "^0.4.13",
74
- "@rsdoctor/webpack-plugin": "^0.4.13",
75
- "@rspack/core": "1.2.8",
76
- "@rspack/dev-server": "^1.0.10",
77
- "@rspack/plugin-react-refresh": "^1.0.1",
73
+ "@rsdoctor/rspack-plugin": "^1.0.2",
74
+ "@rsdoctor/webpack-plugin": "^1.0.2",
75
+ "@rspack/core": "1.3.7",
76
+ "@rspack/dev-server": "^1.1.1",
77
+ "@rspack/plugin-react-refresh": "^1.4.1",
78
78
  "@statoscope/webpack-plugin": "^5.29.0",
79
79
  "@statoscope/stats": "^5.28.1",
80
80
  "@statoscope/stats-extension-compressed": "^5.28.1",