-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
PLIP: Reset define
in RequireJS after bundles loaded
#1529
Comments
+1 for any solution that would allow us to use (in general arbitrary) JS add-ons in Plone. |
There has been a similar workaround in plone with jquery by providing "jq" pointing to "jQuery". People then just started to wrap their JS in anonymous functions. It might be an option to apply this pattern with require as well
It would be an option to generate the wrapper around bundles if desired. So there's no real code changes needed in recent bundles, no "require" and "define" by default and a clear way to write requirejs using code. |
undefined
in RequireJS after bundles loaded
undefined
in RequireJS after bundles loadeddefine
in RequireJS after bundles loaded
define
in RequireJS after bundles loadeddefine
in RequireJS after bundles loaded
Does it really have to be a PLIP? |
+100 |
+1 |
@vangheem The PLIP has been approved by the Framework Team. |
Is there any implementation/branch already around? |
If the title of this PLIP applies it's not what I was suggesting ;) I was thinking about wrapping each bundle if desired but the "core" bundle, loading the JS basics and immediately undefining |
Recently I unset I got a lot of " I thought it could have been due to the async behavior, that some JS was just loaded while the browser has unset Whatever the case was, when AMD tried to load its resources, Isn't it likely that the same happens when implementing this PLIP? |
I think @thet adressed the issue long time ago and the plip can be closed. Reopen if your of a different opinion and start working on it... |
Proposer : vangheem
Seconder : bloodbare
Abstract
Reset the requirejs
define
global variable in Plone so add-on developers do not have to learn how to use requirejs if they are including js that expect requirejs to be used.Motivation
We have integrators that face
Uncaught Error: Mismatched anonymous define
errors and do not know how to deal with it. While this is documented in RequireJS and there are answers on stackoverflow, it is still annoying and difficult to deal with as an integrator.Also see: https://community.plone.org/t/third-party-js-add-ons-inside-one-template/1950
Assumptions
Proposal & Implementation
define
toundefined
after the built resources are includedDeliverables
Risks
This breaks behavior with normal requirejs usage. Developers will need to change how they are using requirejs in their projects if they are using it without the built bundles as
define
will no longer be supported OOTB outside of plone's bundles.The text was updated successfully, but these errors were encountered: