@mandujs/core 0.8.0 → 0.8.1
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 +1 -1
- package/src/bundler/build.ts +6 -6
package/package.json
CHANGED
package/src/bundler/build.ts
CHANGED
|
@@ -62,6 +62,10 @@ function generateRuntimeSource(): string {
|
|
|
62
62
|
* Fresh-style dynamic import architecture
|
|
63
63
|
*/
|
|
64
64
|
|
|
65
|
+
// React 정적 import (Island와 같은 인스턴스 공유)
|
|
66
|
+
import React from 'react';
|
|
67
|
+
import { createRoot } from 'react-dom/client';
|
|
68
|
+
|
|
65
69
|
// Hydrated roots 추적 (unmount용)
|
|
66
70
|
const hydratedRoots = new Map();
|
|
67
71
|
|
|
@@ -134,17 +138,13 @@ async function loadAndHydrate(element, src) {
|
|
|
134
138
|
const { definition } = island;
|
|
135
139
|
const data = getServerData(id);
|
|
136
140
|
|
|
137
|
-
// React
|
|
138
|
-
const { createRoot } = await import('react-dom/client');
|
|
139
|
-
const React = await import('react');
|
|
140
|
-
|
|
141
|
-
// Island 컴포넌트
|
|
141
|
+
// Island 컴포넌트 (정적 import된 React 사용)
|
|
142
142
|
function IslandComponent() {
|
|
143
143
|
const setupResult = definition.setup(data);
|
|
144
144
|
return definition.render(setupResult);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
// Mount
|
|
147
|
+
// Mount (상단에서 import한 createRoot 사용)
|
|
148
148
|
const root = createRoot(element);
|
|
149
149
|
root.render(React.createElement(IslandComponent));
|
|
150
150
|
hydratedRoots.set(id, root);
|