VirgilSecurity / virgil-crypto-javascript

Virgil JavaScript Crypto Library is a high-level cryptographic library that allows you to perform all necessary operations for secure storing and transferring data and everything required to become HIPAA and GDPR compliant.
https://developer.virgilsecurity.com/docs/how-to#cryptography
BSD 3-Clause "New" or "Revised" License
35 stars 4 forks source link

[v5.0.0] Error: Cannot find module '@virgilsecuritycore-foundationode.cjs.js' #94

Closed behrad-kzm closed 1 year ago

behrad-kzm commented 1 year ago

I have issue with 5.0.0 version. the code with version 4.2.2 works fine but at the version 5.0.0 I have this issue:

Error: Cannot find module '@virgilsecuritycore-foundationode.cjs.js'
Require stack:
- /usr/src/app/node_modules/virgil-crypto/dist/node.cjs.js
- ...

this is the v4.2.2 issued file: Screenshot 2023-05-12 at 2 13 06 AM

v5.0.0 issued file: Screenshot 2023-05-12 at 2 14 39 AM

It seems there is a problem with the line 4.

am I doing something wrong?

knightcode commented 1 year ago

ibid

rstp-god commented 1 year ago

Thanks for reporting! Working on this issue! @behrad-kzm

rstp-god commented 1 year ago

@behrad-kzm Hello! Solve your problem in 5.0.1 release!

knightcode commented 1 year ago

@rstp-god so... Version 5.0.1 works for server side code, but webpack is balking for the frontend javascript. Below is the error for worker.es.js, but the same is thrown for browser.es.js. And, while I'm compiling es modules, the cjs versions of those libs seem to reference the same missing file.

I can replace the the path, ./dist/ with @virgilsecurity/core-foundation to get the working import:

import foundationWasm from '@virgilsecurity/core-foundation/libfoundation.worker.wasm';

Should be an easy fix.

ERROR in ./node_modules/virgil-crypto/worker.es.js 2:0-62
Module not found: Error: Can't resolve './dist/libfoundation.worker.wasm' in '/app/node_modules/virgil-crypto'
resolve './dist/libfoundation.worker.wasm' in '/app/node_modules/virgil-crypto'
  using description file: /app/node_modules/virgil-crypto/package.json (relative path: .)
    using description file: /app/node_modules/virgil-crypto/package.json (relative path: ./dist/libfoundation.worker.wasm)
      no extension
        /app/node_modules/virgil-crypto/dist/libfoundation.worker.wasm doesn't exist
      .ts
        /app/node_modules/virgil-crypto/dist/libfoundation.worker.wasm.ts doesn't exist
      .tsx
        /app/node_modules/virgil-crypto/dist/libfoundation.worker.wasm.tsx doesn't exist
      .js
        /app/node_modules/virgil-crypto/dist/libfoundation.worker.wasm.js doesn't exist
      .jsx
        /app/node_modules/virgil-crypto/dist/libfoundation.worker.wasm.jsx doesn't exist
      as directory
        /app/node_modules/virgil-crypto/dist/libfoundation.worker.wasm doesn't exist
rstp-god commented 1 year ago

@knightcode Hello! release 5.0.2 return those files inside dist should work fine now!

behrad-kzm commented 1 year ago

@rstp-god thanks for paying attention, It works properly now!🥳 I will close this issue.