adminizer

This is an example of customizing a custom widget (CustomOne) in a React application that is built using Vite.

1. Custom Widget Definition (fixture/test-widgets/Custom.ts)

2. React Component (modules/test/ComponentB.tsx)

3. Vite Build Configuration (modules/test/vite.config.module.ts)

How It All Works Together

  1. CustomOne defines the widget’s metadata and where its JavaScript lives.
  2. ComponentB provides the interactive UI (a counter button with a message).
  3. Vite compiles the React component into a standalone ES module (ComponentB.es.js).
    • In development, it loads the .tsx file directly.
    • In production, it loads the optimized .es.js file from a CDN-like path (/assets/modules/).

This setup allows the widget to be reusable, dynamically loaded, and integrated into a larger application.