Project

Profile

Help

Bug #4669

closed

SaxonJS object is empty using Webpack

Added by John Dziurlaj over 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Category:
API
Sprint/Milestone:
-
Start date:
2020-08-05
Due date:
% Done:

100%

Estimated time:
Applies to JS Branch:
2
Fix Committed on JS Branch:
2
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

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.

Actions #1

Updated by Michael Kay over 4 years ago

  • Category set to API
  • Assignee set to Debbie Lockett
  • Priority changed from Low to Normal
Actions #2

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?

Actions #3

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.

Actions #4

Updated by Community Admin almost 4 years ago

  • Applies to JS Branch 2 added
  • Applies to JS Branch deleted (2.0)
Actions #5

Updated by Norm Tovey-Walsh over 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:

  1. I cloned the CDFConverter repository,
  2. dropped in the updated SaxonJS files,
  3. ran npm install
  4. 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?

Actions #6

Updated by Norm Tovey-Walsh over 3 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.

Actions #7

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.

Actions #8

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.

Actions #9

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