@iyulab/router 0.10.2 → 0.10.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.
- package/CHANGELOG.md +9 -0
- package/README.md +29 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.10.3] - 2026-07-24
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **root 안에 `<u-outlet>` 이 없을 때 초기화 실패가 삼켜지던 문제 수정** (U-CMMS React+Vite E2E 실측, ISSUE-20260722-router-react-consumption #1). `waitOutlet` 은 타임아웃 시 서술적 오류로 reject 하지만, `Router` 생성자가 `void waitOutlet(...).then(...)` 로 거부를 처리하지 않아 폴링 타임아웃(최대 10초) 뒤 unhandled rejection 으로만 새어 나갔다 — 소비자에겐 원인 없는 빈 화면이었다. 이제 `.catch()` 로 `console.error('Router initialization failed:', …)` 에 명시적으로 표면화한다.
|
|
7
|
+
|
|
8
|
+
### Documentation
|
|
9
|
+
- README에 "React + Vite" 섹션 추가 — 아웃렛의 `react-dom/client` 동적 import 가 Vite dev 사전번들(`optimizeDeps`)에서 깨지는 CJS interop 을 `optimizeDeps.exclude: ['@iyulab/router']` + `include: ['react-dom/client']` 로 해소하는 소비 설정 명시(초안 #2).
|
|
10
|
+
- Quick Start 에 root 의 `<u-outlet>` 요구 + 부재 시 로그 메시지 명시.
|
|
11
|
+
|
|
3
12
|
## [0.10.2] - 2026-07-15
|
|
4
13
|
|
|
5
14
|
### Changed
|
package/README.md
CHANGED
|
@@ -29,6 +29,35 @@ const router = new Router({
|
|
|
29
29
|
router.go('/users/1');
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
> The router renders matched output into a `<u-outlet>` inside `root`. Make sure one exists:
|
|
33
|
+
>
|
|
34
|
+
> ```html
|
|
35
|
+
> <div id="app"><u-outlet></u-outlet></div>
|
|
36
|
+
> ```
|
|
37
|
+
>
|
|
38
|
+
> If `root` contains no `<u-outlet>`, the router logs
|
|
39
|
+
> `Router initialization failed: Timed out waiting for <u-outlet>` and renders nothing.
|
|
40
|
+
|
|
41
|
+
## React + Vite
|
|
42
|
+
|
|
43
|
+
The outlet renders React content by dynamically importing `react-dom/client` when a route
|
|
44
|
+
returns a React element. Under Vite's dev pre-bundling (`optimizeDeps`), this CommonJS
|
|
45
|
+
interop can break — `TypeError: createRoot is not a function` by default, or
|
|
46
|
+
`ReferenceError: module is not defined` if only the router is excluded. Pre-bundle
|
|
47
|
+
`react-dom/client` while leaving the router itself unbundled:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
// vite.config.ts
|
|
51
|
+
import { defineConfig } from 'vite';
|
|
52
|
+
|
|
53
|
+
export default defineConfig({
|
|
54
|
+
optimizeDeps: {
|
|
55
|
+
exclude: ['@iyulab/router'],
|
|
56
|
+
include: ['react-dom/client'],
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
32
61
|
## Skills Usage
|
|
33
62
|
|
|
34
63
|
Install the `iyulab-router` skill for agent-friendly package guidance.
|
package/dist/index.js
CHANGED
|
@@ -419,6 +419,8 @@ var Router = class {
|
|
|
419
419
|
if (config.useIntercept !== false) this._rootElement.addEventListener("click", this.handleRootElementClick);
|
|
420
420
|
if (config.initialLoad !== false) waitOutlet(this._rootElement).then(() => {
|
|
421
421
|
this.go(window.location.href);
|
|
422
|
+
}).catch((error) => {
|
|
423
|
+
console.error("Router initialization failed:", error instanceof Error ? error.message : error);
|
|
422
424
|
});
|
|
423
425
|
}
|
|
424
426
|
/** 객체를 정리하고 이벤트 리스너를 제거합니다. */
|