leancodepl / leancodepl/flutter_webp

Transformer doesn't work for assets with resolution-aware variants

Open
#13 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Dart
Stars
9
Forks
0
PR merge metrics
No merged PRs in 30d

Description

For assets that have their corresponding 2.0x/ variant, the transformer fails.

This may have something to do with the fact, that input and output paths is the same for all the resolution-aware variant files, command was ran with these params for logo_dark.png, 2.0x/logo_dark.png, and 3.0x/logo_dark.png:

input: /var/folders/mh/n8gr4_w94sndpqg3619xhxxh0000gn/T/flutter_tools.sUFfrh/logo_dark.png-transformOutput0.png output: /var/folders/mh/n8gr4_w94sndpqg3619xhxxh0000gn/T/flutter_tools.sUFfrh/logo_dark.png-transformOutput1.png
input: /var/folders/mh/n8gr4_w94sndpqg3619xhxxh0000gn/T/flutter_tools.sUFfrh/logo_dark.png-transformOutput0.png output: /var/folders/mh/n8gr4_w94sndpqg3619xhxxh0000gn/T/flutter_tools.sUFfrh/logo_dark.png-transformOutput1.png
input: /var/folders/mh/n8gr4_w94sndpqg3619xhxxh0000gn/T/flutter_tools.sUFfrh/logo_dark.png-transformOutput0.png output: /var/folders/mh/n8gr4_w94sndpqg3619xhxxh0000gn/T/flutter_tools.sUFfrh/logo_dark.png-transformOutput1.png

Reproduce

Change transformer args in example/pubspec.yaml to '--z=9', '--from_path' (so that the transformation takes enough time for the bug to occur.

When created an 2.0x/example_image.png in the example project inside this repository and building Web, this is the error output:

Target web_release_bundle failed: PathNotFoundException: Cannot copy file to 'build/web/assets/assets/images/2.0x/example_image.png', path = '/var/folders/mh/n8gr4_w94sndpqg3619xhxxh0000gn/T/flutter_tools.81PVsJ/example_image.png-transformOutput1.png' (OS Error: No such file or
directory, errno = 2)

So because the source and output files are the same, Flutter CLI also tries to copy the same file more than once which fails for all attempts except for the first one.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the transformer arguments in example/pubspec.yaml and reproduce the Web build using resolution-aware assets such as 2.0x/example_image.png. Trace how the transformer handles the input and output paths for each variant, then verify that every variant is transformed and copied successfully without PathNotFoundException.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
build-system, tooling, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.