@quark-fw/plugin-react 0.1.3 → 0.1.5

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": "@quark-fw/plugin-react",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "main": "src/index.ts",
5
5
  "types": "src/index.ts",
6
6
  "type": "module",
@@ -21,8 +21,8 @@
21
21
  "access": "public"
22
22
  },
23
23
  "dependencies": {
24
- "@quark-fw/atom": "0.1.3",
25
- "@quark-fw/plugin": "0.1.3",
24
+ "@quark-fw/atom": "0.1.5",
25
+ "@quark-fw/plugin": "0.1.5",
26
26
  "@trpc/client": "^11.0.0",
27
27
  "@types/react-dom": "^19.2.3",
28
28
  "@vitejs/plugin-react": "^5.1.4",
@@ -37,8 +37,8 @@
37
37
  "@mantine/dates": "^8.3.18",
38
38
  "@mantine/modals": "^8.3.18",
39
39
  "@mantine/notifications": "^8.3.18",
40
- "@quark-fw/core": "0.1.3",
41
- "@quark-fw/store": "0.1.3",
40
+ "@quark-fw/core": "0.1.5",
41
+ "@quark-fw/store": "0.1.5",
42
42
  "react": "^19.2.4",
43
43
  "react-dom": "^19.2.4",
44
44
  "react-router-dom": "^7.13.2"
@@ -53,6 +53,12 @@ const workspacePackages = (cwd: string): string[] => {
53
53
  }
54
54
  };
55
55
 
56
+ /** Плагин поставлен из npm (лежит внутри node_modules), а не симлинкован из монорепы. */
57
+ const installedFromRegistry = fs
58
+ .realpathSync(__dirname)
59
+ .replace(/\\/g, "/")
60
+ .includes("/node_modules/");
61
+
56
62
  /** Единая конфигурация vite для dev-сервера и для сборки. */
57
63
  export function createViteConfig(overrides?: InlineConfig): InlineConfig {
58
64
  return {
@@ -63,8 +69,30 @@ export function createViteConfig(overrides?: InlineConfig): InlineConfig {
63
69
  tsconfigPaths(),
64
70
  loadModulesFromExternalFolderPlugin(),
65
71
  ],
72
+ // Установленный из реестра плагин лежит в node_modules, куда
73
+ // @vitejs/plugin-react не заглядывает (у него exclude /node_modules/).
74
+ // Без явного automatic-рантайма его собственный JSX собирается в
75
+ // React.createElement и падает с "React is not defined".
76
+ esbuild: { jsx: "automatic", jsxImportSource: "react" },
66
77
  optimizeDeps: {
67
78
  exclude: workspacePackages(process.cwd()),
79
+ // Плагин исключён из оптимизации, поэтому vite не сканирует его
80
+ // импорты: установленный из реестра, он тянет react-router и mantine
81
+ // сырыми, и CJS-пакеты внутри них (cookie) падают на named-импортах.
82
+ // В монорепо, наоборот, форсировать пре-бандл нельзя — рядом с
83
+ // симлинкованными исходниками появилась бы вторая копия React.
84
+ include: installedFromRegistry
85
+ ? [
86
+ "react",
87
+ "react-dom",
88
+ "react-dom/client",
89
+ "react-router-dom",
90
+ "@mantine/core",
91
+ "@mantine/dates",
92
+ "@mantine/modals",
93
+ "@mantine/notifications",
94
+ ]
95
+ : [],
68
96
  },
69
97
  ...overrides,
70
98
  };