cloverfield-tools / cf-package

Cloverfield Package Scaffold
MIT License
98 stars 14 forks source link

[#45] Adds libraryTarget to webpack config for correct exports #46

Closed rudolf closed 8 years ago

rudolf commented 8 years ago

Without a libraryTarget the webpack bundle is simply a self executing function and so when imported, the function gets run, but never returns any code for the parent module to use, making the module useless.

The difference between the targets commonjs and commonjs2 are small, but the commonjs webpack compiler strips away __esModule which breaks ES6 imports of modules created with cf-package.