dart-lang/pub

Workspaces bundle all assets from all packages

Opened this issue · 0 comments

Environment

  • Dart version: 3.6.0
  • MacOS
  • Are you using the Chinese community mirror or a corporate firewall? NO

Problem

When using the new pub workspaces, I've found a bug where assets from all packages are bundled in the built app, rather than assets from just the packages that the Flutter app depends on.

This seems to occur when packages in the workspace depend on a common shared package - in this case one called base.

Steps to reproduce

Given a Flutter monorepo that uses pub workspaces in this setup:

  • base - a Flutter package with an asset
  • included_package - a Flutter package with an asset that depends on base
  • excluded_package - a Flutter package with an asset that depends on base
  • app - a Flutter app that depends on ONLY included_package

Build the app via flutter build web in the app package.

Expected results

A Flutter app is built containing only the assets from included_package.

Actual results

A Flutter app is built containing the assets from all packages.

Code sample

Code sample See this Github repo for a sample: https://github.com/josh-burton/flutter_workspace_assets_bug

Also filed in Flutter repo: flutter/flutter#160142