Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

script tags to use type="module" #3697

Open
1 task
johrstrom opened this issue Jul 29, 2024 · 0 comments
Open
1 task

script tags to use type="module" #3697

johrstrom opened this issue Jul 29, 2024 · 0 comments
Labels
area/tech debt epic Very large tickets
Milestone

Comments

@johrstrom
Copy link
Contributor

johrstrom commented Jul 29, 2024

With all the javascript errors I'm encountering in #3688 and the various jQuery related errors we've seen in the past, I'm now realizing that we need better encapsulation in these files.

What all these errors boil down to is this: jQuery in application.js is required in other js files, so we set it as a global variable attached to the window. This is super fragile and indeed seems to work by coincidence. Its fragile specifically because we end up making additions to this global variable and that can cause a lot of wonkiness especially if the actual javascript file that's been built has different jQuery definitions (i.e., datatables is attached to one of the imports, but not the other).

This ticket is to fix up our asset pipeline and use of javascript files so that we don't have to fix mysterious jQuery errors every 6 months. I think half of it is reducing our dependency on jQuery (preferring plain ol javascript if we can) and correcting our imports & exports so that the resulting javascript files will always work.

@johrstrom johrstrom added area/tech debt epic Very large tickets labels Jul 29, 2024
@osc-bot osc-bot added this to the Backlog milestone Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tech debt epic Very large tickets
Projects
None yet
Development

No branches or pull requests

2 participants