Vite bundler configuration in V4

The original error is

 RollupError: Expression expected in node_modules/@offset-dev/strapi-calendar/admin/src/pages/app.js  

which seems like it’s not expecting jsx, so the fix is the following vite.config.ts in the root folder of the application

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [
    react(),
  ],
  esbuild:{
    loader: "tsx", // OR "jsx",
    include: [
      // Add this for business-as-usual behaviour for .jsx and .tsx files
      "src/**/*.jsx",
      "src/**/*.tsx",
      "node_modules/**/*.jsx",
      "node_modules/**/*.tsx",

      // Add the specific files you want to allow JSX syntax in
      // "node_modules/bad-jsx-in-js-component/index.js",
      // "node_modules/bad-jsx-in-js-component/js/BadJSXinJS.js",
      // "node_modules/bad-jsx-in-js-component/ts/index.ts",
      // "node_modules/bad-jsx-in-js-component/ts/BadTSXinTS.ts",

      // --- OR ---

      // Add these lines to allow all .js files to contain JSX
      "src/**/*.js",
      "node_modules/**/*.js",

      // Add these lines to allow all .ts files to contain JSX
      "src/**/*.ts",
      "node_modules/**/*.ts",
    ]
  }
})