fix: remove CJS require shim from ESM bundle (Vite 6 + externalize react/jsx-runtime)

This commit is contained in:
jessy-david-dev
2026-04-28 17:08:44 +02:00
parent 046763a6b2
commit 6f53349ac2
3 changed files with 618 additions and 270 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "a11y-widget", "name": "a11y-widget",
"version": "1.0.0", "version": "1.0.1",
"description": "Widget d'accessibilité", "description": "Widget d'accessibilité",
"type": "module", "type": "module",
"main": "./dist/accessibility-widget.umd.cjs", "main": "./dist/accessibility-widget.umd.cjs",
@@ -48,7 +48,7 @@
"@types/node": "^24.12.2", "@types/node": "^24.12.2",
"@types/react": "^19.2.14", "@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3", "@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.1", "@vitejs/plugin-react": "^4.7.0",
"eslint": "^10.2.1", "eslint": "^10.2.1",
"eslint-plugin-react-hooks": "^7.1.1", "eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.2", "eslint-plugin-react-refresh": "^0.5.2",
@@ -57,7 +57,7 @@
"react-dom": "^19.2.5", "react-dom": "^19.2.5",
"typescript": "~6.0.2", "typescript": "~6.0.2",
"typescript-eslint": "^8.58.2", "typescript-eslint": "^8.58.2",
"vite": "^4.0.0", "vite": "^6.4.2",
"vite-plugin-dts": "^4.5.4" "vite-plugin-dts": "^4.5.4"
} }
} }
+613 -266
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -13,11 +13,12 @@ export default defineConfig({
formats: ["es", "umd"], formats: ["es", "umd"],
}, },
rollupOptions: { rollupOptions: {
external: ["react", "react-dom"], external: ["react", "react-dom", "react/jsx-runtime"],
output: { output: {
globals: { globals: {
react: "React", react: "React",
"react-dom": "ReactDOM", "react-dom": "ReactDOM",
"react/jsx-runtime": "ReactJSXRuntime",
}, },
}, },
}, },