Skip to content

Commit

Permalink
fix(vite): refactor "module cache" to "evaluated modules", pass down …
Browse files Browse the repository at this point in the history
resolve vitejs#1560

vitejs/vite@e83beff の反映です。
  • Loading branch information
shuuji3 committed Sep 25, 2024
1 parent d029458 commit b02e4e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions guide/api-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ export class ModuleRunner {
`ModuleRunner` のモジュール評価機能はコードの実行を担当します。Vite は `ESModulesEvaluator` をエクスポートしており、`new AsyncFunction` を使用してコードを評価します。JavaScript ランタイムが安全でない評価をサポートしていない場合は、独自の実装を提供できます。
モジュールランナーは `import` メソッドを公開します。Vite サーバーが `full-reload` HMR イベントをトリガーすると、影響を受けるすべてのモジュールが再実行されます。このとき、モジュールランナーは `exports` オブジェクトを更新しないことに注意してください(上書きされます)。最新の `exports` オブジェクトが必要であれば、 `import` を実行するか、もう一度 `moduleCache` からモジュールを取得する必要があります。
モジュールランナーは `import` メソッドを公開します。Vite サーバーが `full-reload` HMR イベントをトリガーすると、影響を受けるすべてのモジュールが再実行されます。このとき、モジュールランナーは `exports` オブジェクトを更新しないことに注意してください(上書きされます)。最新の `exports` オブジェクトが必要であれば、 `import` を実行するか、もう一度 `evaluatedModules` からモジュールを取得する必要があります。
**使用例:**
Expand Down Expand Up @@ -704,7 +704,7 @@ export interface ModuleRunnerOptions {
/**
* カスタムモジュールキャッシュ。指定されていない場合は、モジュールランナーインスタンスごとに個別のモジュールキャッシュが作成されます。
*/
moduleCache?: ModuleCacheMap
evaluatedModules?: EvaluatedModules
}
```
Expand Down

0 comments on commit b02e4e9

Please sign in to comment.