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

Misguiding document on authoring libraries #6896

Open
ziofat opened this issue Jun 9, 2023 · 0 comments
Open

Misguiding document on authoring libraries #6896

ziofat opened this issue Jun 9, 2023 · 0 comments
Assignees

Comments

@ziofat
Copy link

ziofat commented Jun 9, 2023

In the document Authoring libraries, it's mentioned to install lodash as a devDependency, since we don't want to bundle it together. Also, it's suggested to list it as a peerDependency and put it in the external option. I believe this is a misguidance.

Firstly, if lodash is used within a library, there would be require('lodash') or import from 'lodash' statements, which clearly indicate a direct dependency. Therefore, it should be listed in dependencies.

If users use a bundler to package their own applications, once your library is installed, lodash will also be installed and can be deduplicated with the lodash versions depended on by other libraries used by users. In this case, all you need to do is put ALL dependencies into the external option.

If users are importing your library through a script tag, bundling utility libraries like lodash isn't necessarily a bad practice.

Regardless, lodash should never be listed as a peerDependency or a devDependency.

@alexander-akait alexander-akait transferred this issue from webpack/webpack Jun 9, 2023
@snitin315 snitin315 self-assigned this Mar 24, 2024
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

2 participants