hadars 0.1.38 → 0.1.39-rc.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/dist/cli.js CHANGED
@@ -1314,16 +1314,12 @@ var buildCompilerConfig = (entry, opts, includeHotPlugin) => {
1314
1314
  compilation.hooks.childCompiler.tap(
1315
1315
  "HadarsWorkerChunkLoading",
1316
1316
  (childCompiler) => {
1317
- const libType = childCompiler.options?.output?.library?.type;
1318
- if (libType === "module" || libType === "commonjs" || libType === "commonjs2") {
1319
- return;
1320
- }
1317
+ const lib = childCompiler.options?.output?.library;
1318
+ const libType = typeof lib === "string" ? lib : lib?.type;
1319
+ if (libType) return;
1321
1320
  if (childCompiler.options?.output) {
1322
1321
  childCompiler.options.output.chunkLoading = "import-scripts";
1323
1322
  }
1324
- if (childCompiler.options?.experiments) {
1325
- childCompiler.options.experiments.outputModule = false;
1326
- }
1327
1323
  }
1328
1324
  );
1329
1325
  });
package/dist/ssr-watch.js CHANGED
@@ -215,16 +215,12 @@ var buildCompilerConfig = (entry2, opts, includeHotPlugin) => {
215
215
  compilation.hooks.childCompiler.tap(
216
216
  "HadarsWorkerChunkLoading",
217
217
  (childCompiler) => {
218
- const libType = childCompiler.options?.output?.library?.type;
219
- if (libType === "module" || libType === "commonjs" || libType === "commonjs2") {
220
- return;
221
- }
218
+ const lib = childCompiler.options?.output?.library;
219
+ const libType = typeof lib === "string" ? lib : lib?.type;
220
+ if (libType) return;
222
221
  if (childCompiler.options?.output) {
223
222
  childCompiler.options.output.chunkLoading = "import-scripts";
224
223
  }
225
- if (childCompiler.options?.experiments) {
226
- childCompiler.options.experiments.outputModule = false;
227
- }
228
224
  }
229
225
  );
230
226
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hadars",
3
- "version": "0.1.38",
3
+ "version": "0.1.39-rc.1",
4
4
  "description": "Minimal SSR framework for React — rspack, HMR, TypeScript, Bun/Node/Deno",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
@@ -278,21 +278,24 @@ const buildCompilerConfig = (
278
278
  compilation.hooks.childCompiler.tap(
279
279
  'HadarsWorkerChunkLoading',
280
280
  (childCompiler: any) => {
281
- // Skip internal rspack child compilers that already have an
282
- // explicit library type (e.g. HtmlRspackPlugin template
283
- // compilations use library: { type: 'module', name: '' }).
284
- // Forcing outputModule:false on those triggers the rspack
285
- // ModuleLibraryPlugin "name can't be empty" panic in production.
286
- const libType = childCompiler.options?.output?.library?.type;
287
- if (libType === 'module' || libType === 'commonjs' || libType === 'commonjs2') {
288
- return;
289
- }
281
+ // Only target child compilers that have no explicit library
282
+ // configuration those are the ones rspack creates for
283
+ // `new Worker(new URL(...))` entries. Internal rspack child
284
+ // compilers (HtmlRspackPlugin, chunk-splitting, etc.) carry a
285
+ // library config (often { type: 'module', name: '' }) and
286
+ // must be left untouched: forcing outputModule:false on them
287
+ // while library.type === 'module' triggers the rspack
288
+ // ModuleLibraryPlugin "name can't be empty" panic.
289
+ // NOTE: we intentionally do NOT set experiments.outputModule
290
+ // here — that field lives on internal compilations and
291
+ // modifying it is what causes the panic. Setting
292
+ // chunkLoading alone is sufficient to fix classic workers.
293
+ const lib = childCompiler.options?.output?.library;
294
+ const libType = typeof lib === 'string' ? lib : lib?.type;
295
+ if (libType) return;
290
296
  if (childCompiler.options?.output) {
291
297
  childCompiler.options.output.chunkLoading = 'import-scripts';
292
298
  }
293
- if (childCompiler.options?.experiments) {
294
- childCompiler.options.experiments.outputModule = false;
295
- }
296
299
  },
297
300
  );
298
301
  });