JavaScript/Sass build pipeline
The resources build pipeline in Build/ uses Webpack to bundle React / Yoast
components (wrapped as web components via @r2wc/), build the Yoast webworker and compile
SCSS into production CSS assets.
Prerequisites
- Node.js v22.20.0 (see
Build/)resources/. nvmrc - Yarn package manager
Install dependencies:
cd Build/resources
yarn install
Copied!
Commands
Build (production)
cd Build/resources
yarn build
Copied!
Start (development server)
cd Build/resources
yarn start
Copied!
Start with Hot Module Replacement
cd Build/resources
yarn start:hot
Copied!
Tech stack
- Webpack 5 via
@wordpress/scripts - React with
@r2wc/for wrapping React components as custom elementsreact- to- web- component - Babel for JavaScript transpilation
- SCSS / PostCSS for stylesheets
- Yoast packages:
yoastseo,@yoast/,analysis- report @yoast/,components @yoast/,search- metadata- previews @yoast/, and moresocial- metadata- previews
JavaScript entries
Configured in Build/:
webcomponents.tsx
- Entry
./javascript/ webcomponents. tsx - Output
Resources/Public/ Java Script/ dist/ webcomponents. js - Description
- Bundles all 13 React-based web components. Each React component is wrapped with
@r2wc/and registered as a custom element. See Web Components for the full component reference.react- to- web- component
worker.js
- Entry
./javascript/ worker. js - Output
Resources/Public/ Java Script/ dist/ worker. js - Description
- The Yoast SEO analysis web worker that performs text analysis in a background thread.
SCSS entries
backend-module.scss
- Entry
./sass/ backend- module. scss - Output
Resources/Public/ CSS/ yoast- seo- backend. min. css - Description
- Styles for the Yoast SEO backend module (overview, dashboard).
yoast.scss
- Entry
./sass/ yoast. scss - Output
Resources/Public/ CSS/ yoast. min. css - Description
- Core Yoast SEO styles used across the TYPO3 backend interface.
Webpack configuration
The build uses a base configuration in Build/ that
extends @wordpress/ with:
- Babel loader for all
.jsfiles Removeto clean up empty JS files generated from SCSS-only entriesEmpty Scripts Plugin - Custom
DefineforPlugin process.andenv. NODE_ DEBUG SCRIPT_DEBUG - The
DependencyfromExtraction Webpack Plugin @wordpress/is removed since dependencies are bundled rather than externalizedscripts