@ecomiq/storefront 2.0.2 → 2.0.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/vite-inline.mjs +27 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecomiq/storefront",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Micro framework SSR de Ecomiq para storefronts. Páginas, datos y deploy sin configurar nada.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -17,6 +17,28 @@ const postcssBrowserStub = fileURLToPath(
17
17
 
18
18
  const frameworkRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..')
19
19
 
20
+ /** Packages que workerd debe ver como ESM (sin prebundle CJS con `require`). */
21
+ const SSR_NO_EXTERNAL = [
22
+ '@tanstack/react-start',
23
+ '@tanstack/react-router',
24
+ '@tanstack/react-query',
25
+ '@tanstack/router-core',
26
+ '@tanstack/history',
27
+ '@tanstack/react-store',
28
+ '@tanstack/start-server-core',
29
+ '@tanstack/start-client-core',
30
+ '@tanstack/start-storage-context',
31
+ '@ecomiq/storefront',
32
+ '@ecomiq/core',
33
+ ]
34
+
35
+ const OPTIMIZE_EXCLUDE = [
36
+ '@tanstack/react-start',
37
+ '@tanstack/start-server-core',
38
+ '@tanstack/start-client-core',
39
+ '@tanstack/react-router',
40
+ ]
41
+
20
42
  function resolveSanitizeHtmlPostcss(source, importer) {
21
43
  if (source !== 'postcss') return null
22
44
  if (!importer?.includes('/sanitize-html/')) return null
@@ -75,25 +97,14 @@ export function createViteConfig({ appDir, config, projectRoot }) {
75
97
  '@tanstack/react-query',
76
98
  ],
77
99
  },
78
- // Evita que Vite externalice TanStack como file:// absoluto (rompe workerd/pnpm).
100
+ // Bundlear TanStack en SSR (no externalizar) evita `file://` de pnpm y
101
+ // mantiene ESM. No usar optimizeDeps.include: el prebundle mete `require`
102
+ // y workerd (ESM) falla con "require is not defined".
79
103
  ssr: {
80
- noExternal: [
81
- '@tanstack/react-start',
82
- '@tanstack/react-router',
83
- '@tanstack/react-query',
84
- '@tanstack/router-core',
85
- '@tanstack/history',
86
- '@tanstack/react-store',
87
- '@ecomiq/storefront',
88
- '@ecomiq/core',
89
- ],
104
+ noExternal: [...SSR_NO_EXTERNAL],
90
105
  },
91
106
  optimizeDeps: {
92
- include: [
93
- '@tanstack/react-start',
94
- '@tanstack/react-router',
95
- '@tanstack/react-query',
96
- ],
107
+ exclude: [...OPTIMIZE_EXCLUDE],
97
108
  },
98
109
  plugins: [
99
110
  tailwindcss(),