Bug #4669
closedSaxonJS object is empty using Webpack
100%
Description
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 Michael Kay over 4 years ago
- Category set to API
- Assignee set to Debbie Lockett
- Priority changed from Low to Normal
Updated by Debbie Lockett over 4 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 4 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 Community Admin almost 4 years ago
- Applies to JS Branch 2 added
- Applies to JS Branch deleted (
2.0)
Updated by Norm Tovey-Walsh almost 4 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,
- ran
npm install
- and
npm start
.
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?
Updated by Norm Tovey-Walsh almost 4 years ago
- Status changed from In Progress to Resolved
I believe that fixing the SaxonJS internals to neither create nor refer to an implicit global named SaxonJS
has resolved this issue.
Updated by John Dziurlaj over 3 years ago
You will need to run npm run build
to run the webpack builder which will refresh the built files under /docs
.
Updated by Norm Tovey-Walsh over 3 years ago
- Status changed from Resolved to Closed
This issue has been resolved in the Saxon 2.2 maintenance release.
Updated by Debbie Lockett over 3 years ago
- % Done changed from 0 to 100
- Fixed in JS Release set to Saxon-JS 2.2
- Fix Committed on JS Branch 2 added
Please register to edit this issue
Also available in: Atom PDF Tracking page