FiguredLimited / vue-mc

Models and Collections for Vue
https://vuemc.io
MIT License
627 stars 98 forks source link

Add an unbundled output that uses ES6 modules #85

Open BehindTheMath opened 5 years ago

BehindTheMath commented 5 years ago

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.

rtheunissen commented 5 years ago

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.

BehindTheMath commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

@rtheunissen What are your thoughts about this?

rtheunissen commented 5 years ago

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.