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

[proposal]: Mark all node_modules dependencies as external #27

Open
unrevised6419 opened this issue Feb 10, 2025 · 1 comment
Open

[proposal]: Mark all node_modules dependencies as external #27

unrevised6419 opened this issue Feb 10, 2025 · 1 comment
Labels
issue: enhancement Issue suggesting an enhancement to an existing feature

Comments

@unrevised6419
Copy link

unrevised6419 commented Feb 10, 2025

A clear and concise description of what the feature is

Mark all node_modules dependencies as external to avoid code duplication.

Why should this feature be included?

When developers create plugins within the Strapi application repository, there can be a case when new dependencies are added in the project root, but they are used in both, the application and plugin, and on build the dependency code will be duplicated.

Also, a plugin is only consumed by a Strapi application, so it should not care what node_modules dependencies should be bundled or not, that is Strapi responsibility.

Please provide an example for how this would work

I made this a video to provide a better explanation.

https://youtu.be/WxyGLWjZ2Qs

Another real example of the problem

https://youtu.be/hF74HFJ0K1s

Another solution would be with ESLint to disallow any imports outside the plugin folder.

https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md

For now I solved it with ESLint plugin, found 3 dependencies that were bundled with the plugin. This should also increase build speed.

PS: I'm not sure if this is more an issue for sdk-plugin or pack-up

@unrevised6419 unrevised6419 added the issue: enhancement Issue suggesting an enhancement to an existing feature label Feb 10, 2025
@unrevised6419
Copy link
Author

unrevised6419 commented Feb 10, 2025

Potentially related issue strapi/sdk-plugin#77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: enhancement Issue suggesting an enhancement to an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants