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

feat: add link_workspace_root to nodejs_binary, npm_package_bin, rollup_bundle, terser_minified, ts_project #2175

Merged
merged 1 commit into from
Sep 9, 2020

Conversation

gregmagolan
Copy link
Collaborator

Link the workspace root to the bin_dir to support absolute requires like 'my_wksp/path/to/file'.
If source files need to be required then they can be copied to the bin_dir with copy_to_bin.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sucks that we have to add this attribute to a handful of rules. Maybe other rules will need it too?
We could hang it on a repository rule and wire that up somehow, but it might be too magical.
Any other ideas?

@gregmagolan
Copy link
Collaborator Author

gregmagolan commented Sep 8, 2020

It sucks that we have to add this attribute to a handful of rules. Maybe other rules will need it too?
We could hang it on a repository rule and wire that up somehow, but it might be too magical.
Any other ideas?

Not sure how it could be done as a repository rule. I also like being able to turn it on for specific rules instead of globally (if at all) as it can have unexpected side-effects.

…up_bundle, terser_minified, ts_project

Link the workspace root to the bin_dir to support absolute requires like 'my_wksp/path/to/file'.
If source files need to be required then they can be copied to the bin_dir with copy_to_bin.
@kellycampbell
Copy link
Contributor

Would be good to mention this new flag on the 2.0 upgrade wiki section related to it: https://github.com/bazelbuild/rules_nodejs/wiki#no-longer-link-the-workspace-root

@alexeagle
Copy link
Collaborator

Thanks @kellycampbell good point

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

Successfully merging this pull request may close these issues.

4 participants