@gravity-ui/app-builder 0.27.0 → 0.28.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',
@@ -143,7 +155,7 @@ async function buildDevServer(config) {
143
155
  options.ipc = path.resolve(paths_1.default.appDist, 'run/client.sock');
144
156
  }
145
157
  const proxy = options.proxy || [];
146
- if (config.client.lazyCompilation) {
158
+ if (config.client.lazyCompilation && bundler !== 'rspack') {
147
159
  proxy.push({
148
160
  context: ['/build/lazy'],
149
161
  target: `http://localhost:${config.client.lazyCompilation.port}`,
@@ -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,30 +288,13 @@ 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
- },
311
- test(module) {
312
- // make sure that lazy-client.js won't be lazy compiled)
313
- return !module.nameForCondition()?.endsWith('lazy-client.js');
314
- },
297
+ prefix: '/build/lazy-',
315
298
  };
316
299
  }
317
300
  const filesystemCacheOptions = typeof config.cache === 'object' && config.cache.type === 'filesystem'
@@ -3,9 +3,9 @@ export declare function createCli(argv: string[]): {
3
3
  [x: string]: unknown;
4
4
  verbose: boolean | undefined;
5
5
  cdn: string | undefined;
6
- c: unknown;
7
6
  env: string[] | undefined;
8
7
  target: "client" | "server" | undefined;
8
+ c: unknown;
9
9
  inspect: number | undefined;
10
10
  inspectBrk: number | undefined;
11
11
  "inspect-brk": number | undefined;
@@ -31,9 +31,9 @@ export declare function createCli(argv: string[]): {
31
31
  [x: string]: unknown;
32
32
  verbose: boolean | undefined;
33
33
  cdn: string | undefined;
34
- c: unknown;
35
34
  env: string[] | undefined;
36
35
  target: "client" | "server" | undefined;
36
+ c: unknown;
37
37
  inspect: number | undefined;
38
38
  inspectBrk: number | undefined;
39
39
  "inspect-brk": number | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.27.0",
3
+ "version": "0.28.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,20 +70,20 @@
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.9",
76
+ "@rspack/dev-server": "^1.1.1",
77
+ "@rspack/plugin-react-refresh": "^1.4.1",
78
+ "@statoscope/webpack-plugin": "^5.29.0",
78
79
  "@statoscope/stats": "^5.28.1",
79
80
  "@statoscope/stats-extension-compressed": "^5.28.1",
80
81
  "@statoscope/webpack-model": "^5.29.0",
81
- "@statoscope/webpack-plugin": "^5.29.0",
82
82
  "@svgr/core": "^8.1.0",
83
83
  "@svgr/plugin-jsx": "^8.1.0",
84
84
  "@svgr/webpack": "^8.1.0",
85
- "@swc/core": "1.10.12",
86
- "@swc/plugin-transform-imports": "6.4.0",
85
+ "@swc/core": "1.11.24",
86
+ "@swc/plugin-transform-imports": "7.0.3",
87
87
  "babel-loader": "^9.2.1",
88
88
  "babel-plugin-import": "^1.13.8",
89
89
  "babel-plugin-inline-react-svg": "^2.0.2",