I had a plugin up and running with a scss to css compiler. Suddenly after I moved a few files into a better structure I get this error while building the block:

ERROR in ./blocks/random-game/src/style.scss 8:1
Module parse failed: Unexpected token (8:1)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|  */
>  .wp-block-random-game {
| }
 @ ./blocks/random-game/src/index.js 15:0-22 

I don't understand why this happens and where I have to add a loader. I started with the create block script and built the plugin from there. Everything else works:

[./blocks/random-game/src/edit.js] 1.45 KiB {index} [built]
[./blocks/random-game/src/index.js] 983 bytes {index} [built]
[./blocks/random-game/src/save.js] 487 bytes {index} [built]
[./blocks/random-game/src/style.scss] 277 bytes {index} [built] [failed] [1 error]

Any idea where I can add the loader?


I ran these commands again and everything started to work again:

npm update    
npm install @wordpress/scripts --save-dev

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.