vue-mc icon indicating copy to clipboard operation
vue-mc copied to clipboard

Add an unbundled output that uses ES6 modules

Open BehindTheMath opened this issue 7 years ago • 5 comments
trafficstars

Many users use Webpack or another bundler to bundle this library with their code. For such a use case, there's no need for them to have this library already bundled.

BehindTheMath avatar Oct 21 '18 14:10 BehindTheMath

I'm not convinced of the practicality of this. Bundlers usually don't compile files in node_modules. It does seem obvious to me that we should provide a pure ES6 output but in my experience when I was setting up the bundling, it wasn't easy to work with in that state.

rtheunissen avatar Oct 28 '18 21:10 rtheunissen

Bundlers usually don't compile files in node_modules.

I'm not sure what you mean by that. The whole point of a bundler is to bundle your code along with the libraries you depend on, into a single file.

So, besides publishing an ES6 bundle, we can also publish the transpiled ES6 sources, and that way any user that is also using a bundler won't have it bundled twice.

BehindTheMath avatar Oct 28 '18 21:10 BehindTheMath

Also, unless Rollup has a way to bundle the type declaration files as well, we need to publish the unbundled ES6 sources along with the type files.

BehindTheMath avatar Oct 28 '18 22:10 BehindTheMath

@rtheunissen What are your thoughts about this?

BehindTheMath avatar Nov 11 '18 21:11 BehindTheMath

I think that is the attempt behind the vue-mc.es.js file that is generated, which corresponds to the module entry in the package.json. I'm not a pro with Javascript bundlers though so will take a look around to see how other projects are doing this.

rtheunissen avatar Nov 15 '18 04:11 rtheunissen