Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

The main entry point in the package.json's do not refer to the dist folder #1539

Closed
tyronedougherty opened this issue Nov 3, 2017 · 2 comments

Comments

@tyronedougherty
Copy link

In all package.json npm module definitions for all components, the current pattern seems to be to set the main property to the entry point of the source code, rather than the built distribution. I'm not particularly sure if there is a reason behind that.

This does however mean that you are putting the responsibility of building these packages onto the consumer, as webpack and other build tools will just take the main entry point. This can lead to issues if the consumer does not first build the module, such as UglifyJS failing due to the presence of ES6+ code.

In most other packages I have seen, the main property is set to the entry point from the dist folder, ensuring that the consumer does not have to worry about building the module first.

For example, in https://github.com/petkaantonov/bluebird/blob/master/package.json, the main property is set to ./js/release/bluebird.js, as it is the entry point of the prebuilt distributable.

Another example is https://github.com/gcanti/fp-ts/blob/master/package.json, where the main entry point is listed as being lib/index.js, as it is the prebuilt distributable.

This greatly simplifies the process for the consumer, as they are ready straight away to use any of the MDC components when they import them, rather than having to build them themselves.


In summary, I propose moving all package.json main properties to reference the built file in the dist directory, rather than the entry point of the source code.

Thoughts?

@lynnmercier
Copy link
Contributor

Is this a duplicate of #929. We've had a couple issues filed around whether or not we should serve our ES6+ code.

@amsheehan
Copy link
Contributor

This is a duplicate as mentioned by Lynn. Closing.

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

No branches or pull requests

3 participants