Dynamic Import - CI/CD用語集の定義
dynamic import は実行時にオンデマンドでモジュールをロードし、bundler にとっての code splitting ポイントも兼ねます。
dynamic import は、ファイルの先頭で静的に import する代わりに、実行時にモジュールをロードして promise を返す import() 式です。bundler はこれを code splitting の境界として使います。
const mod = await import("./heavy.js") と書くと、bundler にそのモジュールを、コードが実行されたときにのみ取得される別の chunk に配置するよう指示します。これが lazy loading を支えます。CI では、動的に import されるパスが解決できない場合、build は失敗します。
関連ガイド
Code Splitting - CI/CD Glossary DefinitionCode Splitting: Code splitting breaks a bundle into multiple smaller chunks that load on demand rather than a…
Lazy Loading - CI/CD Glossary DefinitionLazy Loading: Lazy loading defers loading a resource or module until it is actually needed, rather than at in…
Chunk - CI/CD Glossary DefinitionChunk: A chunk is one of the output files a bundler produces when it splits code. Each chunk groups a set of…