Использование собственного криптомодуля в приложении Angular - PullRequest
0 голосов
/ 12 февраля 2020

Недавнее обновление библиотеки crypto- js переключается на использование собственного модуля шифрования базовой ОС, насколько я понимаю.

В результате моя сборка завершается неудачно (многословно) вывод ниже), если я использую обновленную версию, так как кажется, что она не подключена в конфигурации по умолчанию Angular webpack.

Как заставить crypto-js найти ее?

Этот комментарий поразителен, но я не знаю достаточно основополагающих концепций библиотек, чтобы ориентироваться самостоятельно.

WARNING in ./node_modules/crypto-js/core.js
Module not found: Error: Can't resolve 'crypto' in '/tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto-js'
resolve 'crypto' in '/tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto-js'
  Parsed request is a module
  using description file: /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto-js/package.json (relative path: .)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      looking for modules in /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8
        using description file: /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/package.json (relative path: .)
          Field 'browser' doesn't contain a valid alias configuration
          using description file: /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/package.json (relative path: ./crypto)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/crypto doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/crypto.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/crypto.tsx doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/crypto.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/crypto.js doesn't exist
            as directory
              /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/crypto doesn't exist
      /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto-js/node_modules doesn't exist or is not a directory
      /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/node_modules doesn't exist or is not a directory
      /tmp/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
      looking for modules in /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules
        using description file: /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
          using description file: /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/package.json (relative path: ./node_modules/crypto)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto.tsx doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto.js doesn't exist
            as directory
              /tmp/build_fa83cfc445ddeaf2cca1c12ae9bcefc8/node_modules/crypto doesn't exist
...