@timber-js/app 0.2.0-alpha.103 → 0.2.0-alpha.104

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timber-js/app",
3
- "version": "0.2.0-alpha.103",
3
+ "version": "0.2.0-alpha.104",
4
4
  "description": "Vite-native React framework built for Servers and Serverless Platforms — correct HTTP semantics, real status codes, pages that work without JavaScript",
5
5
  "keywords": [
6
6
  "cloudflare-workers",
package/src/index.ts CHANGED
@@ -369,10 +369,28 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
369
369
  envOutDirs[envName] = { build: { outDir: join(buildOutDir, envName) } };
370
370
  }
371
371
 
372
+ // Exclude @timber-js/app packages from the dep optimizer.
373
+ // The shims plugin intercepts @timber-js/app/* imports per-environment
374
+ // (e.g. replacing @timber-js/app/server with a stub in the client env).
375
+ // The dep optimizer runs before per-environment resolution, so it would
376
+ // pre-bundle @timber-js/app/cookies with the real server code inlined,
377
+ // pulling AsyncLocalStorage into the browser bundle.
378
+ const timberOptimizeDepsExclude = [
379
+ '@timber-js/app',
380
+ '@timber-js/app/server',
381
+ '@timber-js/app/client',
382
+ '@timber-js/app/cookies',
383
+ '@timber-js/app/cache',
384
+ '@timber-js/app/search-params',
385
+ '@timber-js/app/segment-params',
386
+ '@timber-js/app/codec',
387
+ ];
388
+
372
389
  if (command === 'build') {
373
390
  return {
374
391
  build: { outDir: buildOutDir },
375
392
  environments: envOutDirs,
393
+ optimizeDeps: { exclude: timberOptimizeDepsExclude },
376
394
  oxc: {
377
395
  jsx: {
378
396
  development: false,
@@ -408,6 +426,7 @@ export function timber(config?: TimberUserConfig): PluginOption[] {
408
426
  return {
409
427
  build: { outDir: buildOutDir },
410
428
  environments: envOutDirs,
429
+ optimizeDeps: { exclude: timberOptimizeDepsExclude },
411
430
  server: serverConfig,
412
431
  preview: previewConfig,
413
432
  };