Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package.json should have main attribute #127

Open
gregveres opened this issue Dec 5, 2017 · 1 comment
Open

package.json should have main attribute #127

gregveres opened this issue Dec 5, 2017 · 1 comment

Comments

@gregveres
Copy link

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
Copy link
Author

gregveres commented Dec 6, 2017

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant