dynamic-import

Enforce static imports over dynamic import() in TypeScript and JavaScript code.

3|1|Updated Mar 29, 2026
One-click install
npx skills add https://github.com/ncaq/konoka --skill dynamic-import-ncaq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dynamic-import
Source: https://github.com/ncaq/konoka/tree/main/plugins/web-tasuke/skills/dynamic-import
Command: npx skills add https://github.com/ncaq/konoka --skill dynamic-import-ncaq

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The guideline reduces the use of dynamic import() in TypeScript/JavaScript, promoting static imports to improve static analysis, tooling compatibility, and code readability.

Core Features & Use Cases

  • Enforces static imports for most modules to improve bundling, type checking, and tree-shaking.
  • Documents acceptable dynamic import usage for scenarios like lazy loading, code-splitting, or conditional loading.
  • Aids code reviews and refactoring by providing clear rules and practical examples.

Quick Start

Refactor code to use static imports instead of dynamic import() wherever possible.

Frequently Asked Questions about dynamic-import

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why prefer static imports over dynamic import() in JavaScript and TypeScript?

Static imports improve static analysis, tooling compatibility, type checking, and code readability, whereas dynamic import() reduces these benefits and complicates tree-shaking during bundle optimization.

When should I use dynamic import() instead of static imports?

Dynamic import() is acceptable for lazy loading, route-based code splitting, or conditional loading scenarios, but static imports should be the default for most modules to ensure better bundling.

How do I enforce static imports during code reviews and linting?

You can enforce static imports by applying linting rules that flag dynamic import() usage, providing clear refactoring guidelines and practical examples to replace them with static imports.

Does replacing dynamic import() affect tree-shaking and bundle optimization?

Yes, replacing dynamic import() with static imports allows bundlers to perform static analysis and tree-shaking more effectively, resulting in optimized bundles and improved type checking capabilities.

What is the best way to refactor dynamic import() for code quality?

The best way to refactor dynamic import() is to convert them to static imports wherever possible, documenting exceptions only for specific scenarios like lazy loading or code-splitting to maintain code quality.