From harness-claude
Loads ES modules on demand with import() for code splitting and reduced initial bundle size. Use for routes, feature flags, heavy libraries, and conditional polyfills.
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Load ES modules on demand with import() to reduce initial bundle size and enable code splitting
Guides React dynamic imports with React.lazy, Suspense, and import() for code splitting to reduce bundle size and improve startup. Use for modals, routes, below-fold content, large libraries.
Provides step-by-step guidance, configurations, and best practices for code splitting in React, Vue, CSS frontend projects, focusing on performance optimization and accessibility.
Guides Webpack configuration for bundling JS/CSS/assets with loaders/plugins, code splitting, optimization, tree shaking, HMR dev server, and production builds.
Share bugs, ideas, or general feedback.
Load ES modules on demand with import() to reduce initial bundle size and enable code splitting
import('./module.js') to load a module at runtime — it returns a Promise.await in async functions or .then() for cleaner syntax.// Route-based code splitting
async function loadPage(route) {
const module = await import(`./pages/${route}.js`);
module.render();
}
// Feature-flag gating
if (user.hasFeature('charts')) {
const { renderChart } = await import('./charts.js');
renderChart(data);
}
import() can fail (network error, missing module)./* webpackChunkName: "name" */ comments for readable chunk names in webpack.Dynamic import() is a function-like syntax (not a function — it is a language feature) that returns a Promise resolving to the module's namespace object. Unlike static import, it can be used anywhere: inside functions, conditionals, loops, and event handlers.
Trade-offs:
When NOT to use:
https://patterns.dev/javascript/dynamic-import