Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of module export in v4.11.0 broken dependencies #61

Open
Zoobdude opened this issue Nov 25, 2024 · 2 comments
Open

Removal of module export in v4.11.0 broken dependencies #61

Zoobdude opened this issue Nov 25, 2024 · 2 comments

Comments

@Zoobdude
Copy link

Zoobdude commented Nov 25, 2024

When attempting to build my TS using node-opcua 2.134.0 or above, it has been erroring with many Cannot find module 'node-opcua-crypto/web'.

Full log
6.594 node_modules/node-opcua-address-space-base/dist/session_context.d.ts(1,29): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.594 node_modules/node-opcua-address-space/dist/source/interfaces/alarms_and_conditions/ua_certificate_expiration_alarm_ex.d.ts(2,29): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.594 node_modules/node-opcua-address-space/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.d.ts(4,29): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.594 node_modules/node-opcua-certificate-manager/dist/certificate_manager.d.ts(1,29): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.594 node_modules/node-opcua-client/dist/client_base.d.ts(8,29): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.594 node_modules/node-opcua-client/dist/client_session.d.ts(7,29): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.595 node_modules/node-opcua-client/dist/index.d.ts(27,31): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.595 node_modules/node-opcua-client/dist/private/client_session_impl.d.ts(8,36): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.595 node_modules/node-opcua-client/dist/verify.d.ts(3,29): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.595 node_modules/node-opcua-common/dist/opcua_secure_object.d.ts(5,41): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.595 node_modules/node-opcua-secure-channel/dist/source/client/client_secure_channel_layer.d.ts(2,41): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.595 node_modules/node-opcua-secure-channel/dist/source/message_builder.d.ts(2,28): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.595 node_modules/node-opcua-secure-channel/dist/source/security_policy.d.ts(5,83): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.595 node_modules/node-opcua-secure-channel/dist/source/server/server_secure_channel_layer.d.ts(2,58): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.595 node_modules/node-opcua-secure-channel/dist/source/token_stack.d.ts(1,29): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.596 node_modules/node-opcua-server/dist/opcua_server.d.ts(4,36): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.
6.596 node_modules/node-opcua-server/dist/server_end_point.d.ts(6,41): error TS2307: Cannot find module 'node-opcua-crypto/web' or its corresponding type declarations.

My current solution is to pin the version of node-opcua to 2.133.0

This seems to be related to the removal of web.d.ts in commit 4981043.

I realise this issue should have probably been opened on the node-opcua repo, however issues have been restricted to previous contributors only.

@erossignon
Copy link
Member

Hi @Zoobdude ,

If you look at the node-opcua-crypto package you will see that the web modules are present in the export sections.

The import issue comes with typescript and can be easily overcome:

  • make sure you are using typescript > 4.7
  • ensure that your tsconfig use moduleResolution = node16 or nodenext and not 'node'

ref:
https://stackoverflow.com/questions/70296652/how-can-i-use-exports-in-package-json-for-nested-submodules-and-typescript

@erossignon
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants