scottcorgan / tiny-emitter

A tiny (less than 1k) event emitter library
MIT License
935 stars 67 forks source link

main point to dist instead of the root? #25

Closed yannickl88 closed 3 years ago

yannickl88 commented 7 years ago

Should the main file not be the one in the dist folder? Because that file has better compatibility for different javascript loaders.

https://github.com/scottcorgan/tiny-emitter/blob/master/index.js

vs

https://github.com/scottcorgan/tiny-emitter/blob/master/dist/tinyemitter.js

scottcorgan commented 7 years ago

I think the idea is that Node, Webpack, and Browserify will use main to pull in the file and then that file will get transpiled if it needs.

Do you have an example of something different?

scottcorgan commented 7 years ago

Also, dist is meant to be a UMD-style version of the package.

yannickl88 commented 7 years ago

jQuery does something different https://github.com/jquery/jquery/blob/master/package.json#L6 and the factory method it's a common pattern I see everywhere. Even in your dist/index.js.