@gravity-ui/app-builder 0.5.0 → 0.5.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.1](https://github.com/gravity-ui/app-builder/compare/v0.5.0...v0.5.1) (2023-06-26)
4
+
5
+
6
+ ### Features
7
+
8
+ * added the ability to disable entries for webpack lazy compilation ([#32](https://github.com/gravity-ui/app-builder/issues/32)) ([fed462a](https://github.com/gravity-ui/app-builder/commit/fed462a9803f4891ea0aff300133dec45c708fb9))
9
+
3
10
  ## [0.5.0](https://github.com/gravity-ui/app-builder/compare/v0.4.3...v0.5.0) (2023-06-17)
4
11
 
5
12
 
package/README.md CHANGED
@@ -201,6 +201,11 @@ With this `{rootDir}/src/ui/tsconfig.json`:
201
201
  - `watchPackages` (`boolean`) - watch all changes in `node_modules`.
202
202
  - `disableReactRefresh` (`boolean`) — disable `react-refresh` in dev mode.
203
203
  - `detectCircularDependencies` (`true | CircularDependenciesOptions`) - detect modules with circular dependencies, [more](https://github.com/aackerman/circular-dependency-plugin)
204
+ - `lazyCompilation` (`true | LazyCompilationConfig`) — enable experimental [lazy compilation](https://webpack.js.org/configuration/experiments/#experimentslazycompilation) feature
205
+ - `true` — enable feature
206
+ - `LazyCompilationConfig`
207
+ - `port` (`number`) — port where to listen to from the server
208
+ - `entries` (`boolean=true`) — if `false` - disables lazy compilation for `src/ui/entries` folder content
204
209
 
205
210
  ##### Production build
206
211
 
@@ -183,7 +183,12 @@ export type NormalizedClientConfig = Omit<ClientConfig, 'publicPathPrefix' | 'hi
183
183
  hiddenSourceMap: boolean;
184
184
  svgr: NonNullable<ClientConfig['svgr']>;
185
185
  lazyCompilation?: {
186
- port: number;
186
+ port?: number;
187
+ /**
188
+ * @default true
189
+ * disable lazy compilation for entries
190
+ */
191
+ entries?: boolean;
187
192
  };
188
193
  devServer: Omit<DevServerConfig, 'port' | 'type' | 'options'> & {
189
194
  port?: number;
@@ -87,18 +87,7 @@ function webpackConfigFactory(webpackMode, config, { logger } = {}) {
87
87
  level: 'verbose',
88
88
  }
89
89
  : undefined,
90
- experiments: isEnvDevelopment
91
- ? {
92
- lazyCompilation: config.lazyCompilation
93
- ? {
94
- backend: {
95
- client: require.resolve('./lazy-client.js'),
96
- listen: config.lazyCompilation,
97
- },
98
- }
99
- : undefined,
100
- }
101
- : undefined,
90
+ experiments: configureExperiments(helperOptions),
102
91
  snapshot: {
103
92
  managedPaths: config.watchOptions?.watchPackages ? [] : undefined,
104
93
  },
@@ -170,6 +159,36 @@ function configureWatchOptions({ config }) {
170
159
  delete watchOptions.watchPackages;
171
160
  return watchOptions;
172
161
  }
162
+ function configureExperiments({ config, isEnvProduction, }) {
163
+ if (isEnvProduction) {
164
+ return undefined;
165
+ }
166
+ let lazyCompilation;
167
+ let port;
168
+ let entries;
169
+ if (config.lazyCompilation) {
170
+ if (typeof config.lazyCompilation === 'object') {
171
+ port = config.lazyCompilation.port;
172
+ entries = config.lazyCompilation.entries;
173
+ }
174
+ lazyCompilation = {
175
+ backend: {
176
+ client: require.resolve('./lazy-client.js'),
177
+ ...(port
178
+ ? {
179
+ listen: {
180
+ port,
181
+ },
182
+ }
183
+ : {}),
184
+ },
185
+ entries,
186
+ };
187
+ }
188
+ return {
189
+ lazyCompilation,
190
+ };
191
+ }
173
192
  function configureResolve({ isEnvProduction, config, tsLinkedPackages, }) {
174
193
  let alias = config.alias || {};
175
194
  alias = Object.entries(alias).reduce((result, [key, value]) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Develop and build your React client-server projects, powered by typescript and webpack",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",