Feature #4655
openStandard-ESM imports
0%
Description
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
Updated by Norm Tovey-Walsh over 3 years 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.
Updated by Norm Tovey-Walsh over 3 years ago
- Status changed from New to AwaitingInfo
Using "AwaitingInfo" to indicate that we need support from the Closure compiler (or something else) for this.
Updated by Daniel Naab over 3 years ago
Hello,
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.
Updated by Alf Eaton about 3 years ago
One option would be to use Skypack:
import saxonJS from 'https://cdn.skypack.dev/saxon-js';
Updated by Norm Tovey-Walsh about 3 years ago
Thank you for the suggestion. I'll take a look.
Please register to edit this issue
Also available in: Atom PDF Tracking page