Build: create script to generate ESM-compatible code#1956
Conversation
The code, written in AMD module syntax, lives in the "ui"
folder.
A new Grunt task is added ("esmify") that will process every
JavaScript source file in the "ui" folder and convert the AMD
imports into ESM imports.
The transpiled code will be stored in the "esm" folder.
This means that consumers of jquery-ui can choose whether they
want to use the ESM version or the AMD version.
mgol
left a comment
There was a problem hiding this comment.
Thanks for the PR! This looks quite cool but my main worry is the maintenance cost. We have very few resources for jQuery UI these days so as long as code is authored in AMD, I'd rather not add another module system to the repo as there will always be edge cases.
If we were to migrate to ESM and generate AMD, that would be something to think about but even then I'm not sure if we'd do it due to the above.
If you want an ESM version of jQuery UI, can't you publish it as your own package under your npm scope? You can set up some Git hooks to catch new UI releases & re-generate their ESM versions if you want; however, I don't suspect lots of versions being released in a short time range so this shouldn't be such a big issue.
|
@fnagel what do you think? |
|
Thanks for the reply! I think I will go ahead and just publish it as something like
I tried doing that as well, what you could do is run the script I put in this PR and commit the results - it's jQuery-formatted and only affects the first couple of lines. Converting ESM to AMD is much simpler, so the gode generation script would be more manageable. |
|
@mgol I agree we have very limited resources and should rather not add a new module system. |
The code, written in AMD module syntax, lives in the "ui"
folder.
A new Grunt task is added ("esmify") that will process every
JavaScript source file in the "ui" folder and convert the AMD
imports into ESM imports.
The transpiled code will be stored in the "esm" folder.
This means that consumers of jquery-ui can choose whether they
want to use the ESM version or the AMD version.