@gravity-ui/app-builder 0.4.0 → 0.4.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.4.1](https://github.com/gravity-ui/app-builder/compare/v0.4.0...v0.4.1) (2023-05-19)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **worker-loader:** correctly get main worker asset ([#22](https://github.com/gravity-ui/app-builder/issues/22)) ([31984c9](https://github.com/gravity-ui/app-builder/commit/31984c9c057a915233db3d9aed470ce6d4040db4))
9
+
3
10
  ## [0.4.0](https://github.com/gravity-ui/app-builder/compare/v0.3.0...v0.4.0) (2023-05-19)
4
11
 
5
12
 
@@ -23,12 +23,13 @@ const pitch = function (request) {
23
23
  logger.warn('Warning (app-builder-worker-loader): output.globalObject is set to "window". It should be set to "self" or "this" to support HMR in Workers.');
24
24
  }
25
25
  const isEnvProduction = compilerOptions.mode === 'production';
26
- const filename = isEnvProduction
26
+ const filename = 'worker.js';
27
+ const chunkFilename = isEnvProduction
27
28
  ? 'js/[name].[contenthash:8].worker.js'
28
29
  : 'js/[name].worker.js';
29
30
  const workerOptions = {
30
31
  filename,
31
- chunkFilename: filename,
32
+ chunkFilename,
32
33
  publicPath: compilerOptions.output.publicPath,
33
34
  globalObject: 'self',
34
35
  devtoolNamespace: node_path_1.default.resolve('/', node_path_1.default.relative(paths_1.default.app, this.resource)),
@@ -66,27 +67,23 @@ const pitch = function (request) {
66
67
  .join('\n');
67
68
  return cb(new Error('Child compilation failed:\n' + errorDetails));
68
69
  }
69
- const file = Object.keys(compilation.assets)[0];
70
- if (file) {
71
- const contents = compilation.assets[file]?.source();
72
- const mapFile = `${file}.map`;
73
- let map = compilation.assets[mapFile]?.source();
74
- if (map) {
75
- const sourceMap = JSON.parse(map.toString());
76
- if (Array.isArray(sourceMap.sources)) {
77
- sourceMap.sources = sourceMap.sources.map((pathname) => pathname.replace(/webpack:\/\/[^/]+\//, 'webpack://'));
78
- }
79
- map = JSON.stringify(sourceMap);
70
+ const contents = compilation.assets[filename]?.source();
71
+ const mapFile = `${filename}.map`;
72
+ let map = compilation.assets[mapFile]?.source();
73
+ if (map) {
74
+ const sourceMap = JSON.parse(map.toString());
75
+ if (Array.isArray(sourceMap.sources)) {
76
+ sourceMap.sources = sourceMap.sources.map((pathname) => pathname.replace(/webpack:\/\/[^/]+\//, 'webpack://'));
80
77
  }
81
- for (const [fileName, asset] of Object.entries(compilation.assets)) {
82
- if ([file, mapFile].includes(fileName)) {
83
- continue;
84
- }
85
- workerCompiler.parentCompilation?.emitAsset(fileName, asset, compilation.assetsInfo.get(fileName));
78
+ map = JSON.stringify(sourceMap);
79
+ }
80
+ for (const [assetName, asset] of Object.entries(compilation.assets)) {
81
+ if ([filename, mapFile].includes(assetName)) {
82
+ continue;
86
83
  }
87
- return cb(null, contents, map?.toString());
84
+ workerCompiler.parentCompilation?.emitAsset(assetName, asset, compilation.assetsInfo.get(assetName));
88
85
  }
89
- return cb(null, undefined);
86
+ return cb(null, contents, map?.toString());
90
87
  });
91
88
  };
92
89
  exports.pitch = pitch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.4.0",
3
+ "version": "0.4.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",