HubSpot / messenger

Growl-style alerts and messages for your app. #hubspot-open-source
http://github.hubspot.com/messenger/
MIT License
4.03k stars 408 forks source link

package.json should have main attribute #127

Open gregveres opened 6 years ago

gregveres commented 6 years ago

It would be a lot cleaner for users of the package if it had a main attribute as described in this SO answer. https://stackoverflow.com/questions/22512992/node-js-package-json-main-parameter

I think the main should be: 'main': 'build/js/messenger'

gregveres commented 6 years ago

I found a work around with webpack.

given the current state of the package.json, you have to do this:

import "messenger-hubspot/build/js/messenger.js";

but if you add this to the plugin section of your webpack config, you can work around the lack of a main tag:

new webpack.NormalModuleReplacementPlugin(/^messenger$/, 'messenger-hubspot/build/js/messenger.js'),

then you can just do this to import the module:

import "messenger"