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

how to use build_runner in pub workspaces? #3798

Open
kjxbyz opened this issue Jan 26, 2025 · 2 comments
Open

how to use build_runner in pub workspaces? #3798

kjxbyz opened this issue Jan 26, 2025 · 2 comments

Comments

@kjxbyz
Copy link

kjxbyz commented Jan 26, 2025

  1. The following code must be added to the root pubspec.yaml file
dev_dependencies:
  build_runner: ^2.4.14

Otherwise, the following error will be reported

dart pub -C modules/basic/assets run build_runner build --delete-conflicting-outputs
Deprecated. Use `dart run` instead.
Package "build_runner" is not an immediate dependency.
Cannot run executables in transitive dependencies.
make: *** [asset] Error 65
  1. Run the following command in the root directory. Code cannot be generated in the module directory.
dart pub -C modules/basic/assets run build_runner build --delete-conflicting-outputs
Image
@jakemac53
Copy link
Contributor

build_runner does not have any direct support for pub workspaces - you need to still use it as normal (add the dependency to each sub-packages pubspec etc).

It does support workspaces in the sense that it still works, but it doesn't try to share work across the workspace or anything like that, and each package still has to have the dependency.

@jakemac53
Copy link
Contributor

I thought we had an open issue for some better support here but I don't see one, so we can leave this open to track that.

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