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

View entry point not building properly #427

Open
1 task done
Jorgu5 opened this issue Sep 25, 2024 · 1 comment
Open
1 task done

View entry point not building properly #427

Jorgu5 opened this issue Sep 25, 2024 · 1 comment

Comments

@Jorgu5
Copy link

Jorgu5 commented Sep 25, 2024

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

  • I agree to follow this project's Code of Conduct
@fabiankaegy
Copy link
Member

Thanks for this report!

That is very interesting. I had not explored the viewStyle option much thus far. Will need to investigate a bit how we can best remediate this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants