SaxonJS object is empty using Webpack
I am upgrading an application from Saxon 1.x to 2.0 and am running into some issues. Previously I had to modify the SaxonJS code to work with webpack, but now that 2.0 is distributed via NPM I had some hope that those customizations would no longer be necessary. However, when invoking SaxonJS.transform, I get an error that the function does not exist (the object is empty i.e.
Entire codebase with WIP branch available here: https://github.com/HiltonRoscoe/CDFConverter/tree/saxonjs-upgrade
See also #4639.
Updated by Debbie Lockett over 3 years ago
Thanks for getting in touch to let us know about the issue. I'm afraid we don't really have experience with Webpack, but I'll investigate. As you suggest, the problem here could be the same as with the use of SaxonJS in Electron (bug #4639).
Does your application run in the browser, or in Node.js? Note that the version of Saxon-JS 2 on NPM is designed for use in Node.js only; there is a separate download for the Browser platform version, because there are internal differences. I'm not sure how this fits in with using Webpack?
Updated by John Dziurlaj over 3 years ago
Yes, Webpack is designed to package code to be used on the browser side. Many npm packages are designed to work on Node or in the browser, but I take your point.
Electron is similar, there is a "web side" (the UI) that runs in Chrome, and the "node side" that provides Node functionality such as File I/O.
Updated by Norm Tovey-Walsh almost 3 years ago
- Status changed from New to In Progress
As previously noted, we think this is related to the bug reported in #4639. We think we've fixed that bug:
- I cloned the CDFConverter repository,
- dropped in the updated SaxonJS files,
In the browser, I was able to load the sample and convert it to XML without any errors. Is that sufficient to test that it now works correctly?
Please register to edit this issue