Request received from Max Fechner by email:
Thank you for developing saxonJS!
It would be great if you could support standard-esm imports like
import saxonJS from 'http://www.saxonica.com/saxon.js'
this would work in *deno as well as nodejs as well as modern browsers!
thank you for considering this proposal!
best, Max Fechner
#2 Updated by Norm Tovey-Walsh 6 months ago
- Priority changed from Normal to Low
We rely on the Closure compiler to build the release artifacts. As far as I can tell in a couple of days of research, the Closure compiler doesn't offer any options for producing ESM modules and I couldn't find any workarounds that seemed practical. I'll plan to check back periodically, and naturally I'm open to suggestions, but short of support from the compiler, I'm not sure this is something we can do.
#4 Updated by Daniel Naab 4 months ago
Not being familiar with Saxon-JS project structure, I don't know if this is a useful suggestion or not, but typically a project would be refactored to internally use ES modules; then a tool like Rollup could be used to create the distributable artifacts (Rollup, for instance, has a Google Closure plugin - https://github.com/ampproject/rollup-plugin-closure-compiler). Rollup can produce a single ESM with obsfucated code, in addition to something like the current IIFE bundle.
If internally Saxon-JS is difficult to convert to ES modules, Rollup also has plugins to use alternate modules types as input. For instance, using AMD modules - https://www.npmjs.com/package/rollup-plugin-amd
I have some familiarity with doing this, and could help clarify your options, if there is any interest. I am exploring a use case that would benefit from ESM usage, also.
Please register to edit this issue