Skip to content

Scripts: regression - fails to import fonts refered in imported css file from an external npm's dependency #66503

@loxK

Description

@loxK

Description

I have a block that uses flexslider. It fails to build since @wordpress/scripts version 29.0.0

Could it be related to that commit #61121 ?

Step-by-step reproduction instructions

  1. clone my test repo and install npm dependencies
mkdir test
cd test
git clone https://github.com/loxK/wordpress-scripts-test.git ./ -b font-dependency
npm i
  1. build : npm run build

  2. notice the errors importing the font referenced in the felxslider module :

ERROR in ./blocks/editor.scss (./blocks/editor.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[3].use[3]!./blocks/editor.scss) 5:36-89
Module not found: Error: Can't resolve 'fonts/flexslider-icon.eot' in '/home/www/user/Tests/wordpress-scripts-test/blocks'
  1. downgrade to wordpress/scripts v28.6.0, and build :
npm i -D @wordpress/[email protected]
npm build
  1. notice that there are no errors and taht fonts are in assets/blocks/fonts :
# ls assets/blocks/fonts 
flexslider-icon.0c4bb125.eot  flexslider-icon.b5aefbb7.woff  flexslider-icon.c6c9e9e5.ttf

Screenshots, screen recording, code snippet

A test repository to reproduce is available here : https://github.com/loxK/wordpress-scripts-test/tree/font-dependency

Environment info

  • Node v20.18.0
  • Ubuntu 24.04.1 LTS

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

Labels

[Status] In ProgressTracking issues with work in progress[Tool] WP Scripts/packages/scripts[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions