@ecomiq/storefront 2.0.5 → 2.0.7
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/bin/ecomiq.mjs +1 -2
- package/package.json +1 -1
- package/src/vite-inline.mjs +23 -6
package/bin/ecomiq.mjs
CHANGED
|
@@ -89,8 +89,7 @@ export async function runCli(command = process.argv[2] ?? 'help') {
|
|
|
89
89
|
runtime,
|
|
90
90
|
})
|
|
91
91
|
banner(
|
|
92
|
-
`dev · ${config.name ?? 'tienda'} ${c.dim('http://localhost:' + port)}
|
|
93
|
-
(runtime === 'workerd' ? c.dim(' · runtime workerd') : ''),
|
|
92
|
+
`dev · ${config.name ?? 'tienda'} ${c.dim(`· runtime ${runtime}`)} ${c.dim('http://localhost:' + port)}`,
|
|
94
93
|
)
|
|
95
94
|
const server = await createServer({
|
|
96
95
|
...viteConfig,
|
package/package.json
CHANGED
package/src/vite-inline.mjs
CHANGED
|
@@ -59,11 +59,24 @@ function sanitizeHtmlClientBoundary() {
|
|
|
59
59
|
* TanStack Start marca `@tanstack/react-router` como `resolve.external` fuera de
|
|
60
60
|
* su monorepo. Cloudflare Vite plugin no lo tolera y workerd acaba ejecutando
|
|
61
61
|
* CJS con `require` → "require is not defined".
|
|
62
|
+
*
|
|
63
|
+
* Solo aplica en runtime `workerd`. En `node`, React y otras deps CJS deben
|
|
64
|
+
* quedar external: `noExternal` las pasa por el module runner ESM de Vite y
|
|
65
|
+
* falla con "module is not defined".
|
|
62
66
|
* @see https://github.com/TanStack/router/issues/5291
|
|
63
67
|
*/
|
|
64
|
-
function
|
|
68
|
+
function bundleSsrDependenciesForWorkerd() {
|
|
65
69
|
return {
|
|
66
|
-
name: 'ecomiq:
|
|
70
|
+
name: 'ecomiq:ssr-no-external',
|
|
71
|
+
configEnvironment(name) {
|
|
72
|
+
if (name !== 'ssr') return
|
|
73
|
+
return {
|
|
74
|
+
resolve: {
|
|
75
|
+
external: [],
|
|
76
|
+
noExternal: true,
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
},
|
|
67
80
|
configResolved(config) {
|
|
68
81
|
const ssr = config.environments?.ssr
|
|
69
82
|
if (ssr?.resolve) {
|
|
@@ -99,10 +112,11 @@ export function createViteConfig({ appDir, config, projectRoot, runtime }) {
|
|
|
99
112
|
|
|
100
113
|
const resolvedRuntime = resolveDevRuntime({ config, runtime })
|
|
101
114
|
|
|
102
|
-
const plugins = [
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
115
|
+
const plugins = [tailwindcss()]
|
|
116
|
+
|
|
117
|
+
if (resolvedRuntime === 'workerd') {
|
|
118
|
+
plugins.unshift(bundleSsrDependenciesForWorkerd())
|
|
119
|
+
}
|
|
106
120
|
|
|
107
121
|
// workerd emula Cloudflare Workers (opt-in en `ecomiq dev`).
|
|
108
122
|
// Default es Node; build/deploy siempre usan workerd.
|
|
@@ -143,6 +157,9 @@ export function createViteConfig({ appDir, config, projectRoot, runtime }) {
|
|
|
143
157
|
plugins,
|
|
144
158
|
build: {
|
|
145
159
|
cssCodeSplit: false,
|
|
160
|
+
commonjsOptions: {
|
|
161
|
+
transformMixedEsModules: true,
|
|
162
|
+
},
|
|
146
163
|
rollupOptions: {
|
|
147
164
|
output: {
|
|
148
165
|
assetFileNames: (assetInfo) => {
|