Openbravo Issue Tracking System - POS2
View Issue Details
0054990POS2POSpublic2024-03-19 09:532024-04-05 10:26
miguel_lopez 
miguel_lopez 
normalminorhave not tried
newopen 
5
 
 
No
0054990: Portugal Fiscalization module uses "require('node-forge')" and does not provide it in a package.json
org.openbravo.localization.portugal.fiscalization module is supposed to support pos2, posterminal and graalJS.

As part of its pos2 support, this “require('node-forge')” line was added in Utils.js:

This works right now because node-forge is provided in core2 through a transitive dependency from webpack-dev-server, through selfsigned transitive dependency, this is not even intended, it should be provided by the portugal.fiscalization module.

As part of the migration from CRA to Vite we can’t use “require()“, instead static or dynamic imports are preferred.

There are other modules who had to add dependencies and support both oldPOS and pos2, to achieve that, they usually follow these steps:

Have a dual module, creating an web-jspack folder and including a package.json with the required dependency

Create an implementation for core2 specifically in the web-jspack/module/src folder.

Provide the required dependencies in the package.json + its generated package-lock.json

An example of this is the camerabarcodescanner module:

It includes a library for old POS, and an implementation

It includes a web-jspack with the dependency and an implementation for core2

 

We should implement something similar for the portugal fiscalization module to be correct and work. Right now is very fragile, because it depends on that transitive dependency and uses require instead of import.
N/A
No tags attached.
Issue History
2024-03-19 09:53miguel_lopezNew Issue
2024-03-19 09:53miguel_lopezAssigned To => miguel_lopez
2024-03-19 09:53miguel_lopezTriggers an Emergency Pack => No
2024-03-19 10:11hgbotNote Added: 0162330
2024-03-25 12:20hgbotNote Added: 0162588
2024-04-05 10:26hgbotNote Added: 0162875

Notes
(0162330)
hgbot   
2024-03-19 10:11   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.localization.portugal.fiscalization/-/merge_requests/62 [^]
(0162588)
hgbot   
2024-03-25 12:20   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/1516 [^]
(0162875)
hgbot   
2024-04-05 10:26   
Merge request closed: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/1516 [^]