Publishing flat npm packages for easier import paths
eltongarbin opened this issue · comments
Is your feature request related to a problem? Please describe.
I'm always frustrated when I see that the "dist" is part of the import path. Look at the examples below:
import { Container } from '@useblu/ocean-components/dist/Grid';
import { Col } from '@useblu/ocean-components/dist/Grid';
import { Row } from '@useblu/ocean-components/dist/Grid';
This leaves the import path a bit large and is not very elegant.
Describe the solution you'd like
I'd like to omit the directory /dist
of the import path.
Describe alternatives you've considered
Check how the famous libraries are doing.
- (Option 1) https://davidwells.io/blog/publishing-flat-npm-packages-for-easier-import-paths-smaller-consumer-bundle-sizes
- (Option 2) Copy the package.json into the dist folder and then run npm pack inside the dist folder.
This is my proposal for the fix but, as you mentioned in slack, we should also ask ourselves how this will be affected by the Lerna implementation.
So I've been testing the deploy process...
publish the beta22 tag in npm: https://www.npmjs.com/package/@useblu/ocean-components/v/0.1.0-beta.22
with it, the problem is solved, I've tested in a project the import now is without the dist:
with types and everything:
in the installation folder the package looks like this: