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
WIP: Rename the global define
function, plip #1529
#1707
Conversation
You simply reset global define AFTER ALL registered resource bundles have been delivered, right? E.g. https://github.com/collective/collective.js.datatables/blob/master/collective/js/datatables/profiles/plone5/registry.xml <- the JS is delivered as bundle as well... So to make it work right now we implemented a really bad hack -> https://github.com/collective/collective.js.datatables/blob/master/collective/js/datatables/resources/media/js/jquery.dataTables.min.js#L5 define and require gets unset before the actual script is loaded and then reset to the original values -> https://github.com/collective/collective.js.datatables/blob/master/collective/js/datatables/resources/media/js/jquery.dataTables.min.js#L175 That's why I was suggesting to implement a (generated) wrapper around each bundle if desired (except the basic JS, after which define and require should be reset) as described here -> #1529 (comment) Or do I miss something in your approach? |
So in order to achieve the flexibility with bundles, merged in one file or not, delivered JS structure may look somthing like: // jquery as is // requirejs as is // reset define and require
// iterate registered bundle resources
// all bundles delivered with addons |
@rnixx datatables is a unique case where the packaging is exceptionally difficult and not compatible. If you're packaging inside a bundle with requirejs, there is nothing else, no magic, we can do. Some js packages just suck to work with in packaging. This PR is only to help those that have trouble including js from manual |
define
function, plip #1529define
function, plip #1529
This doesn't always work quite as expected as it can mess with other bundling in other unexpected ways. I'm putting this PR on hold for now until we can figure out if there is a more safe way. |
To implement plip: #1529