-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
With web publishable libraries, all dependencies of all files (tests, stories) are added to the package.json #11293
Comments
We remove dev dependencies from the generated package.json IIRC, you may be able to add something like this in your modal libraries dev deps: {
"devDependencies": {
"@my-scope/button": "*"
}
} |
Thanks for the suggestion @AgentEnder, but I don't think that will scale, what if for some reason someone makes a change to the "modal" component and actually imports the button into the source code? then they need to know to remove it from Ideally I think the behaviour should be like the mdx style stories, they just seem to not be taken into account when creating the dependency graph, it might actually be a "bug as a feature" though, because is inconsistent and should behave just like the js stories. |
I've tried adding this to the package.json in my project (not the root one), and it didn't work. The generated packages.json still includes the unwanted dependency. Using executor |
I think this is a valid point. We have a similar issue. In our mono repo, where we have numerous publishable libraries, we also have a Since Nx has such presents in the market already, it would be a good idea to reduce the dependencies as much as possible and declutter the node module mess. (also linking this to #10227 since it is an extension of the issue. And #8096 because it describes something similar) |
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
Hello! I have a question about web publishable libraries.
Context: Most of our libraries are components using React and Storybook, sometimes we import a certain dependency into the story file, but this dependency is not really used in the actual component.
For example, let's say I have 2 Nx publishable libraries:
@my-scope/button
and@my-scope/modal
, in the "modal" story file (Modal.stories.js) we import the button, just to have our button triggering opening the modal. No other file in "modal" uses the button and the index.js doesn't export anything from the stories file.As you can see, button it's not really a dependency of modal. But when I build the modal library, the package.json includes the button in the
dependencies
field... so the question is, how can I avoid that? Is there a way to tell Nx to ignore certain files that I can't see?namedInputs
, orimplicitDependencies
, or something else Nx provides, I did try those but maybe I'm using them wrong?Expected Behavior
I would expect that the dependencies added would only be taken from the entry point (index.js) and expand from there.
Steps to Reproduce
Example 'build' target configuration:
Environment
Thanks!
The text was updated successfully, but these errors were encountered: