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

[Bug] Unused files being referenced in the output code #169

Open
edgardz opened this issue Nov 2, 2021 · 1 comment
Open

[Bug] Unused files being referenced in the output code #169

edgardz opened this issue Nov 2, 2021 · 1 comment
Assignees
Labels
bug Something isn't working low low priority

Comments

@edgardz
Copy link
Collaborator

edgardz commented Nov 2, 2021

Describe the bug

Output code is generating references for unused files.

To Reproduce

Steps to reproduce the behavior:

  1. Add a new image file into assets/images, for instance 'test.png'
  2. Make sure there is no reference whatsoever for this file in the code.
  3. Run a clean build, to simulate the server environment: rm -rf ./out && rm -rf ./.next && npm run build:static
  4. You will see several references for this file in the generated JS bundles.

Screenshots

image

Expected behaviour

Output code should only contain references for actually used files.
The build script should only spend CPU time compressing actually used files.

Environment

  System:
    OS: macOS 11.6
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 586.35 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.16.1 - ~/.nvm/versions/node/v14.16.1/bin/node
    Yarn: 1.22.10 - ~/.nvm/versions/node/v14.16.1/bin/yarn
    npm: 7.9.0 - ~/.nvm/versions/node/v14.16.1/bin/npm
  Browsers:
    Chrome: 95.0.4638.54
    Edge: 95.0.1020.40
    Firefox: 93.0
    Safari: 15.0
  npmPackages:
    react: ^17.0.2 => 17.0.2

Additional context

A similar issue was posted here: cyrilwanner/next-optimized-images#228

@edgardz edgardz added the bug Something isn't working label Nov 2, 2021
@jmckinnell
Copy link
Member

Will keep an eye on this. We're exploring new options for image optimization. Will close this once @grez96's solution is in place.

@jmckinnell jmckinnell added the low low priority label Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low low priority
Projects
None yet
Development

No branches or pull requests

4 participants