DEV Community

Discussion on: Dynamic module import with Stimulus JS

Collapse
 
adrienpoly profile image
Adrien Poly

Yes I didn't emphasize on it. You are right, this is a Webpack feature (probably also supported by other bundlers as it is a JS feature developer.mozilla.org/en-US/docs/W...).

The nice thing with Stimulus is that it pairs very well with the lifecycle events.

Collapse
 
intermundos profile image
intermundos

Indeed, forgot that browser modules have native support for dynamic imports.

Collapse
 
konnorrogers profile image
Konnor Rogers

Just found this, so I'm a little late to the party, but rollup also has first class support for dynamic imports.

rollupjs.org/guide/en/#code-splitting