fix(jquery): make available globally and to plugins

This commit is contained in:
Jack Westbrook
2025-03-03 09:08:14 +01:00
parent 11b6a42bb6
commit 17bb5cec36
3 changed files with 6 additions and 2 deletions
+1
View File
@@ -1,5 +1,6 @@
import 'vite/modulepreload-polyfill';
import './core/trustedTypePolicies';
import './jquery';
// TODO: Vite should have __wepack_public_path support. Not looked into it yet.
// declare let __webpack_public_path__: string;
+3
View File
@@ -0,0 +1,3 @@
// Vite: hacky approach to making jQuery globally available
import jQuery from 'jquery';
Object.assign(window, { $: jQuery, jQuery });
+2 -2
View File
@@ -24,8 +24,8 @@ export default defineConfig({
},
plugins: [react(), angularHtmlImport()],
optimizeDeps: {
// fix for $ is not a function
exclude: ['jquery'],
// fixes for dependencies that don't support esm
include: ['jquery'],
},
resolve: {
alias: [