wcz-test 6.12.8 → 6.12.9
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/vite.js +9 -9
- package/dist/vite.js.map +1 -1
- package/package.json +1 -1
package/dist/vite.js
CHANGED
|
@@ -14,16 +14,16 @@ function viteWczLayout() {
|
|
|
14
14
|
return {
|
|
15
15
|
optimizeDeps: {
|
|
16
16
|
exclude: [virtualModuleId],
|
|
17
|
+
// Force Vite to pre-bundle MUI/Emotion packages
|
|
18
|
+
// This ensures their CJS dependencies (react-is, prop-types, hoist-non-react-statics)
|
|
19
|
+
// are converted to ESM during pre-bundling, not at runtime
|
|
17
20
|
include: [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"@
|
|
21
|
-
"@
|
|
22
|
-
"@mui/
|
|
23
|
-
"@mui/
|
|
24
|
-
"@mui/utils > react-is",
|
|
25
|
-
"@mui/utils > prop-types",
|
|
26
|
-
"@mui/material > @emotion/react > hoist-non-react-statics"
|
|
21
|
+
"@emotion/react",
|
|
22
|
+
"@emotion/styled",
|
|
23
|
+
"@mui/material",
|
|
24
|
+
"@mui/system",
|
|
25
|
+
"@mui/utils",
|
|
26
|
+
"@mui/icons-material"
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
ssr: {
|
package/dist/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","sources":["../src/lib/vite-plugin.ts"],"sourcesContent":["import fs from \"node:fs\";\r\nimport path from \"node:path\";\r\nimport type { Resource } from \"i18next\";\r\nimport type { Plugin } from \"vite\";\r\n\r\nexport function viteWczLayout(): Plugin {\r\n const virtualModuleId = \"virtual:wcz-layout\";\r\n const resolvedVirtualModuleId = \"\\0\" + virtualModuleId;\r\n\r\n let localesPath: string;\r\n\r\n return {\r\n name: \"vite:wcz-layout\",\r\n enforce: \"pre\",\r\n configResolved(resolvedConfig) {\r\n localesPath = path.resolve(resolvedConfig.root, \"src/locales\");\r\n },\r\n config() {\r\n return {\r\n optimizeDeps: {\r\n exclude: [virtualModuleId],\r\n
|
|
1
|
+
{"version":3,"file":"vite.js","sources":["../src/lib/vite-plugin.ts"],"sourcesContent":["import fs from \"node:fs\";\r\nimport path from \"node:path\";\r\nimport type { Resource } from \"i18next\";\r\nimport type { Plugin } from \"vite\";\r\n\r\nexport function viteWczLayout(): Plugin {\r\n const virtualModuleId = \"virtual:wcz-layout\";\r\n const resolvedVirtualModuleId = \"\\0\" + virtualModuleId;\r\n\r\n let localesPath: string;\r\n\r\n return {\r\n name: \"vite:wcz-layout\",\r\n enforce: \"pre\",\r\n configResolved(resolvedConfig) {\r\n localesPath = path.resolve(resolvedConfig.root, \"src/locales\");\r\n },\r\n config() {\r\n return {\r\n optimizeDeps: {\r\n exclude: [virtualModuleId],\r\n // Force Vite to pre-bundle MUI/Emotion packages\r\n // This ensures their CJS dependencies (react-is, prop-types, hoist-non-react-statics)\r\n // are converted to ESM during pre-bundling, not at runtime\r\n include: [\r\n \"@emotion/react\",\r\n \"@emotion/styled\",\r\n \"@mui/material\",\r\n \"@mui/system\",\r\n \"@mui/utils\",\r\n \"@mui/icons-material\",\r\n ],\r\n },\r\n ssr: {\r\n noExternal: [\"@mui/*\"],\r\n },\r\n };\r\n },\r\n resolveId(id) {\r\n if (id === virtualModuleId) return resolvedVirtualModuleId;\r\n return null;\r\n },\r\n load(id) {\r\n if (id !== resolvedVirtualModuleId) return null;\r\n\r\n if (!fs.existsSync(localesPath)) {\r\n fs.mkdirSync(localesPath, { recursive: true });\r\n }\r\n\r\n const enPath = path.join(localesPath, \"en.json\");\r\n if (!fs.existsSync(enPath)) {\r\n fs.writeFileSync(enPath, JSON.stringify({}));\r\n }\r\n\r\n const files = fs.readdirSync(localesPath);\r\n const jsonFiles = files.filter((f) => f.endsWith(\".json\"));\r\n\r\n const resources: Resource = {};\r\n\r\n for (const file of jsonFiles) {\r\n const lang = path.basename(file, \".json\");\r\n const filePath = path.join(localesPath, file);\r\n\r\n try {\r\n const content = fs.readFileSync(filePath, \"utf-8\");\r\n const translations = JSON.parse(content);\r\n resources[lang] = { translation: translations };\r\n } catch (error) {\r\n console.error(`[vite:layout] Error parsing ${file}:`, error);\r\n resources[lang] = { translation: {} };\r\n }\r\n\r\n this.addWatchFile(filePath);\r\n }\r\n\r\n return `export const resources = ${JSON.stringify(resources)};`;\r\n },\r\n };\r\n}\r\n"],"names":[],"mappings":";;AAKO,SAAS,gBAAwB;AACpC,QAAM,kBAAkB;AACxB,QAAM,0BAA0B,OAAO;AAEvC,MAAI;AAEJ,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS;AAAA,IACT,eAAe,gBAAgB;AAC3B,oBAAc,KAAK,QAAQ,eAAe,MAAM,aAAa;AAAA,IACjE;AAAA,IACA,SAAS;AACL,aAAO;AAAA,QACH,cAAc;AAAA,UACV,SAAS,CAAC,eAAe;AAAA;AAAA;AAAA;AAAA,UAIzB,SAAS;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QACJ;AAAA,QAEJ,KAAK;AAAA,UACD,YAAY,CAAC,QAAQ;AAAA,QAAA;AAAA,MACzB;AAAA,IAER;AAAA,IACA,UAAU,IAAI;AACV,UAAI,OAAO,gBAAiB,QAAO;AACnC,aAAO;AAAA,IACX;AAAA,IACA,KAAK,IAAI;AACL,UAAI,OAAO,wBAAyB,QAAO;AAE3C,UAAI,CAAC,GAAG,WAAW,WAAW,GAAG;AAC7B,WAAG,UAAU,aAAa,EAAE,WAAW,MAAM;AAAA,MACjD;AAEA,YAAM,SAAS,KAAK,KAAK,aAAa,SAAS;AAC/C,UAAI,CAAC,GAAG,WAAW,MAAM,GAAG;AACxB,WAAG,cAAc,QAAQ,KAAK,UAAU,CAAA,CAAE,CAAC;AAAA,MAC/C;AAEA,YAAM,QAAQ,GAAG,YAAY,WAAW;AACxC,YAAM,YAAY,MAAM,OAAO,CAAC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