Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

vite_react_generator

38 sites Security covered
View on drupal.org

This module provides a simple way to generate Vite + React Single Directory Components.

  1. Execute drush generate sdc-vite-react.
  2. From the module or theme, execute npm install.
  3. Execute npm run build.

You're all set!

Requirements

Drupal 10.3+

Installation

Install it as you would normally install a contributed Drupal module.

drush pm:install vite_react_generator

Usage

drush generate single-directory-component-vite-react
# or
drush generate sdc-vite-react

Follow the prompts, and you are all set.

DIY Demo

You can try this out with Drupal 10.3+ or Drupal 11. This will create a clean Drupal running in Docker via ddev with Drush, vite_react_generator, and a demo module called my_react_app and a Single Directory Component called my_react_sdc.

ddev config --project-type drupal --create-docroot --docroot web
ddev start
ddev composer create drupal/recommended-project -y

ddev composer require --dev drush/drush
ddev drush site:install --account-name=admin --account-pass=admin -y

ddev composer require 'drupal/vite_react_generator:^1.0'
ddev drush pm:install vite_react_generator

# Create a module with the machine name `my_react_app`
mkdir -p web/modules/custom
ddev drush generate module 
ddev drush pm:install my_react_app

# Use the `my_react_app` module and create a component with the machine name `my_react_sdc`.
ddev drush generate sdc-vite-react

cd web/modules/custom/my_react_app

# Notice that interface translations have been configured.
cat my_react_app.info.yml

npm install

# Type "o + <ENTER>" after it opens the demo in your browser.
npm run dev

npm run build

# Notice your React Single Directory Component.
ls -lR components

# Notice that a translation template has been generated.
ls -l translations
cat translations/my_react_app.pot

Activity

Total releases
5
First release
Feb 2025
Latest release
11 months ago
Release cadence
16 days
Stability
60% stable

Release Timeline

Releases

Version Type Release date
1.0.8 Stable Apr 23, 2025
1.0.7 Stable Apr 16, 2025
1.0.6 Stable Apr 15, 2025
1.0.6-beta1 Pre-release Apr 15, 2025
1.0.5-beta1 Pre-release Feb 17, 2025