Vite + React Single Directory Component (SDC) Generator
This module helps you create Vite + React components within Drupal. It streamlines the process of generating Single Directory Components for your React applications.
This module provides a simple way to generate Vite + React Single Directory Components.
- Execute
drush generate sdc-vite-react. - From the module or theme, execute
npm install. - 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
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Release Timeline
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 1.0.9 | Stable | 10–11 | Adds DDEV development environments for Drupal 10 and 11 to support local development and testing. Consolidates the separate Babel and SWC template directories into a single unified react/ directory. | May 6, 2026 | |
| 1.0.8 | Stable | 10–11 | Apr 23, 2025 | ||
| 1.0.7 | Stable | 10–11 | Bug fixes | Apr 15, 2025 | |
| 1.0.6 | Stable | 10–11 | Initial feature complete version | Apr 15, 2025 | |
| 1.0.6-beta1 | Pre-release | 10–11 | Support Drupal 11. | Apr 15, 2025 | |
| 1.0.5-beta1 | Pre-release | 9–10 | Dependency updates, including support for React 19.x | Feb 17, 2025 | |
| 1.0.4-alpha3 | Pre-release | 9–10 | Changes to resolve Drupal standards violations. | Dec 3, 2024 | |
| 1.0.4-alpha2 | Pre-release | 9–10 | Documentation updates only. | Dec 2, 2024 | |
| 1.0.4-alpha1 | Pre-release | 9–10 | Nov 23, 2024 | ||
| 1.0.3-alpha1 | Pre-release | 9–10 | Bugfixes and Upgrade to ESLint 9.x | Oct 22, 2024 | |
| 1.0.2-alpha1 | Pre-release | 9–10 | Bugfix | Oct 6, 2024 |