Included images cause input buffer error when running build command

Aperta
#417 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript, webpack
Ambito
build-system

Direzione di ricerca

Inizia riproducendo il fallimento con l’inizializzazione dello scaffold segnalata, npm i e npm run build, mantenendo i PNG in themes/{theme-name}/assets/images. Ispeziona la gestione delle immagini di Webpack del toolkit dopo i tre errori “Input buffer contains unsupported image format”. Il lavoro è completato quando la build termina correttamente mentre i file PNG inclusi sono ancora presenti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

[Type] Bug
Describe the bug

After installing a fresh wp-scaffold project using the project command, included png images cause the build to break. If I delete the included .pngs in themes/{theme-name}/assets/images, the error goes away.

Steps to Reproduce
  1. Install a fresh scaffold using the scripts command: npx 10up-toolkit project init [email protected]:10up/wp-scaffold.git --name=starbucks --confirm=yes
  2. Install NPM dependencies npm i
  3. Run npm run build and observe input buffer errors.
Screenshots, screen recording, code snippet

image

Full output:

Initializing project at .
Cloning into '/Users/petersorensen/scaffold-test'...
Composer could not detect the root package (10up/starbucks) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
Package operations: 15 installs, 0 updates, 0 removals
    0 [>---------------------------]    0 [->--------------------------]
  - Installing composer/installers (v2.2.0): Extracting archive
  - Installing squizlabs/php_codesniffer (3.9.0): Extracting archive
  - Installing dealerdirect/phpcodesniffer-composer-installer (v1.0.0): Extracting archive
  - Installing phpcsstandards/phpcsutils (1.0.10): Extracting archive
  - Installing phpcompatibility/php-compatibility (dev-develop a8d6714): Extracting archive
  - Installing phpcompatibility/phpcompatibility-paragonie (1.3.2): Extracting archive
  - Installing phpcompatibility/phpcompatibility-wp (2.1.4): Extracting archive
  - Installing phpcsstandards/phpcsextra (1.2.1): Extracting archive
  - Installing wp-coding-standards/wpcs (3.0.1): Extracting archive
  - Installing sirbrillig/phpcs-variable-analysis (v2.11.17): Extracting archive
  - Installing automattic/vipwpcs (3.0.0): Extracting archive
  - Installing 10up/phpcs-composer (3.0.0): Extracting archive
  - Installing wpackagist-plugin/debug-bar (1.1.4): Extracting archive
  - Installing wpackagist-plugin/debug-bar-slow-actions (0.8.4): Extracting archive
  - Installing wpackagist-plugin/query-monitor (3.15.0): Extracting archive
  0/12 [>---------------------------]   0%
 12/12 [============================] 100%
Generating autoload files
6 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Composer could not detect the root package (10up/starbucks-plugin) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
Package operations: 1 install, 0 updates, 0 removals
  - Installing haydenpierce/class-finder (0.4.3): Extracting archive
Generating autoload files
Composer could not detect the root package (10up/starbucks-theme) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
Package operations: 1 install, 0 updates, 0 removals
  - Installing haydenpierce/class-finder (0.4.3): Extracting archive
Generating autoload files
Project initialized.
? Choose a CI type: GitLab
CI generated.
➜  scaffold-test npm i
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated @humanwhocodes/[email protected]: Use @eslint/config-array instead
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated @humanwhocodes/[email protected]: Use @eslint/object-schema instead
npm warn deprecated [email protected]: This package has been deprecated in favor of @stylistic/stylelint-plugin

> [email protected] prepare
> TEN="$(pwd)"; UP="$(git rev-parse --show-toplevel)"; TENUP="${TEN#"$UP"}"; cd "$(git rev-parse --show-toplevel)"; husky install ."${TENUP}"/.husky

fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
husky - git command not found, skipping install

added 1577 packages, and audited 1581 packages in 6s

356 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
➜  scaffold-test npm run build

> [email protected] build
> npm run build --workspaces --if-present


> [email protected] build
> 10up-toolkit build


✖ Webpack
  Compiled with some errors in 829.04ms

assets by status 46.9 KiB [cached] 24 assets
orphan modules 15.1 KiB (javascript) 4.87 KiB (runtime) [orphan] 41 modules
built modules 6.71 KiB (javascript) 4.83 KiB (css/mini-extract) [built]
  cacheable modules 3.79 KiB (javascript) 4.83 KiB (css/mini-extract)
    javascript modules 3.79 KiB
      modules by path ./assets/js/admin/*.js 268 bytes 2 modules
      + 3 modules
    modules by path ./assets/css/ 4.83 KiB
      modules by path ./assets/css/frontend/*.css 2.14 KiB 2 modules
      + 3 modules
  modules by path ./includes/ 2.91 KiB
    ./includes/block-editor-script.js + 3 modules 645 bytes [not cacheable] [built] [code generated]
    ./includes/blocks/example-block/index.js + 7 modules 2.28 KiB [not cacheable] [built] [code generated]

ERROR in Input buffer contains unsupported image format

ERROR in Input buffer contains unsupported image format

ERROR in Input buffer contains unsupported image format

webpack 5.92.0 compiled with 3 errors in 834 ms
npm error Lifecycle script `build` failed with error:
npm error Error: command failed
npm error   in workspace: [email protected]
npm error   at location: /Users/petersorensen/scaffold-test/themes/starbucks-theme

> [email protected] build
> 10up-toolkit build


✖ Webpack
  Compiled with some errors in 535.16ms

assets by status 38.3 KiB [cached] 12 assets
Entrypoint admin = css/admin.css js/admin.js js/admin.asset.php
Entrypoint frontend = css/frontend.css js/frontend.js js/frontend.asset.php
Entrypoint shared = css/shared.css js/shared.js js/shared.asset.php
orphan modules 3.81 KiB (javascript) 2.92 KiB (runtime) [orphan] 20 modules
cacheable modules 218 bytes (javascript) 36 bytes (css/mini-extract)
  javascript modules 218 bytes
    ./assets/js/admin/admin.js 69 bytes [built] [code generated]
    ./assets/js/frontend/frontend.js 78 bytes [built] [code generated]
    ./assets/js/shared/shared.js 71 bytes [built] [code generated]
  modules by path ./assets/css/ 36 bytes
    css ../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./assets/css/admin/admin-style.css 0 bytes [built] [code generated]
    css ../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./assets/css/frontend/style.css 36 bytes [built] [code generated]
    css ../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./assets/css/shared/shared-style.css 0 bytes [built] [code generated]

ERROR in Input buffer contains unsupported image format

ERROR in Input buffer contains unsupported image format

ERROR in Input buffer contains unsupported image format

webpack 5.92.0 compiled with 3 errors in 540 ms
npm error Lifecycle script `build` failed with error:
npm error Error: command failed
npm error   in workspace: [email protected]
npm error   at location: /Users/petersorensen/scaffold-test/mu-plugins/starbucks-plugin```

### Environment information

_No response_

### WordPress information

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
Lingua principale
JavaScript
Stelle
147
Fork
21
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di 10up/10up-toolkit

Tutte le issue di 10up/10up-toolkit

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.