fbpx

NPM Build Errors When Creating a Block

Last week, as I began to work through the Create a Block Tutorial on WordPress.org, I ran into an issue that I struggled to solve until today.

The Problem

After I created my block scaffolding with npx @wordpress/create-block starter-block and ran npm run build, I got the following error:

Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from./node_modules/@wordpress/scripts/node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin

The Solution

I had to install the following packages and that seems to have done the business.

npm install --save-dev postcss-preset-env mini-css-extract-plugin path css-loader node-sass sass-loader postcss-loader ignore-emit-webpack-plugin

Leave a Comment

Your email address will not be published. Required fields are marked *

GOT A PROJECT? LET’S TALK!

Are you ready to get your work out to the world?

%d bloggers like this: