liferay-react-module

Scaffolds and wires React into Liferay OSGi modules using blade templates or npm-scripts builds.

Updated Jul 24, 2026
One-click install
npx skills add https://github.com/gweone/agent-plugins --skill liferay-react-module-gweone
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: liferay-react-module
Source: https://github.com/gweone/agent-plugins/tree/main/plugin/sharpps-liferay/skills/liferay-react-module
Command: npx skills add https://github.com/gweone/agent-plugins --skill liferay-react-module-gweone

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding React to a traditional Liferay OSGi module involves many moving parts — choosing between a Client Extension and a module, picking the right bundler, keeping React external so duplicate copies don't break hooks, and wiring npm output into the Gradle build. This Skill guides that entire decision and scaffolding process so the module builds and deploys correctly the first time. ## Core Features & Use Cases - Container decision guidance: Checks the workspace's Liferay version and helps decide between a traditional OSGi module and a Custom Element Client Extension before any scaffolding happens. - Two proven patterns: Covers a whole React-driven portlet via blade's npm-react-portlet template (esbuild, plain JS) and React mounted from a custom JSP/FTL tag via @liferay/npm-scripts with TypeScript, modeled on a real modules/search example. - Shared-React safety: Explains the load-bearing --external:react flags and imports mapping to @liferay/frontend-js-react-web that prevent duplicate React copies and "Invalid hook call" errors. - Use Case: A developer needs a React search component rendered inside an existing JSP tag in a DXP workspace — the Skill walks through assembling package.json, npmscripts.config.js, the TS barrel export, bnd.bnd, and the Gradle copyNpmBuild wiring, then deploying with blade gw :modules:search:deploy. ## Quick Start Ask the assistant to set up React in a Liferay module, stating whether the React app is a whole portlet or mounted inside a custom JSP/FTL tag.

Frequently Asked Questions about liferay-react-module

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add React to a Liferay OSGi module?

Use blade's npm-react-portlet template for a whole React portlet, or hand-assemble package.json, npmscripts.config.js, and a TypeScript entry point for tag-mounted React. Then build and deploy with blade gw :modules:<name>:deploy from the workspace root.

Should I use a Liferay Client Extension or a traditional module for React?

Use a Custom Element Client Extension for standalone page widgets on Liferay 7.4+ or quarterly releases. Choose a traditional OSGi module when React must mount inside a JSP/FTL custom tag or when you need a full MVC portlet lifecycle.

Why does my Liferay React portlet throw Invalid hook call errors?

Duplicate React copies on the page cause Invalid hook call errors. Keep react and react-dom external via esbuild's --external flags or the imports mapping to @liferay/frontend-js-react-web so Liferay's shared React resolves at runtime.

Does blade create need a version flag for npm-react-portlet?

No, blade create auto-detects the product and version when run from inside a real workspace root, generating the correct release.dxp.api or release.portal.api dependency. Only pass -v or --liferay-product if blade reports it cannot determine the Liferay version.

Why is tsconfig.json disabled in a Liferay npm-scripts module?

liferay-npm-scripts build transpiles TypeScript without needing a project-level tsconfig.json, so the .disabled suffix does not affect the build. Rename it to tsconfig.json only if you want your editor's TypeScript language server to type-check the module.