10up-toolkit icon indicating copy to clipboard operation
10up-toolkit copied to clipboard

View entry point not building properly

Open Jorgu5 opened this issue 5 months ago • 1 comments

Describe the bug

There appears to be a conflict in the Webpack configuration when view.scss or view.css is present in the block, and the following settings are used:

"useBlockAssets": true,
"useBlockModules": true,
"useScriptModules": true

In this case, the view.ts / view.js is not being bundled properly, as the view CSS seems to be treated as the main entry point, causing the JavaScript to be skipped. As a workaround, I have to use a different name for the view CSS and manually attach it through block.json using the viewStyle property.

Steps to Reproduce

  1. Create a block.
  2. Set "useBlockAssets" to true in the package.json
  3. Create view.css / view.scss and view.ts / view.js file.
  4. Use 10up-toolkit build --watch to see if the view.ts is bundling.

Screenshots, screen recording, code snippet

No response

Environment information

  • Device M2 Pro Sonoma 14.6.1 (23G93)
  • 10up toolkit 6.2.2.

WordPress information

N/A

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

Jorgu5 avatar Sep 25 '24 10:09 Jorgu5