I am also trying to avoid a build step during development using ES6 native modules.
Antoine
11

Hi Antoine.

Did I understand correctly that with Rollup you can create a file Vendors.js from node_modules dependencies, that will be in ES format ? Then how do you use that file in your code ?

No .. Rollup always starts with an es6 Module format, then converts it to iife (“legacy” browser format), cjs (node format), or even es6 Module (combines several Modules into a new, larger Module.

It is, however, possible to use the “anonymous import”, i.e. without a name: `import “path/to/module.js”` with _some_ vendor.js files. Pako, for example, described in the story.

My “wrapper” approach was the only simple, always works, approach I found: simply use the foo.min.js file wrapped in code that turned it into a Module. It also installs it in the window global space if the original foo.min.js did so. It turns out this is important sometimes, like where THREE uses its global to install plugins.

Show your support

Clapping shows how much you appreciated Owen Densmore’s story.