@types/crypto-js를 사용할 때Generate가 불가능한 문제를 수정합니다

yarn add @types/crypto-jsyarn generate 화학반응이 발생한다.
$ yarn generate
...
ERROR in <path-to-project>/node_modules/secure-ls/dist/secure-ls.d.ts
ERROR in <path-to-project>/node_modules/secure-ls/dist/secure-ls.d.ts(4,9):
4:9 Module '"<path-to-project>/node_modules/@types/crypto-js"' has no exported member 'CipherHelper'.
    2 | 
    3 | import * as LZString from 'lz-string';
  > 4 | import {CipherHelper, Encoder} from 'crypto-js';
      |         ^
    5 | 
    6 | declare class SecureLS {
    7 |     constructor(config?: { isCompression?: boolean, encodingType?: string, encryptionSecret?: string , encryptionNamespace?: string });

ERROR in <path-to-project>/node_modules/secure-ls/dist/secure-ls.d.ts
ERROR in <path-to-project>/node_modules/secure-ls/dist/secure-ls.d.ts(4,23):
4:23 Module '"<path-to-project>/node_modules/@types/crypto-js"' has no exported member 'Encoder'.
    2 | 
    3 | import * as LZString from 'lz-string';
  > 4 | import {CipherHelper, Encoder} from 'crypto-js';
      |                       ^
    5 | 
    6 | declare class SecureLS {
    7 |     constructor(config?: { isCompression?: boolean, encodingType?: string, encryptionSecret?: string , encryptionNamespace?: string });

 FATAL  Nuxt build error                                                                                                                                         19:29:50

  at WebpackBundler.webpackCompile (node_modules/@nuxt/webpack/dist/webpack.js:5497:21)
  at processTicksAndRejections (internal/process/task_queues.js:93:5)
  at async WebpackBundler.build (node_modules/@nuxt/webpack/dist/webpack.js:5446:5)
  at async Builder.build (node_modules/@nuxt/builder/dist/builder.js:5634:5)
  at async Generator.initiate (node_modules/@nuxt/generator/dist/generator.js:171:7)
  at async Generator.generate (node_modules/@nuxt/generator/dist/generator.js:133:5)
  at async Object.run (node_modules/@nuxt/cli/dist/cli-generate.js:376:24)
  at async NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:2803:7)


   ╭─────────────────────────────╮
   │                             │
   │   ✖ Nuxt Fatal Error        │
   │                             │
   │   Error: Nuxt build error   │
   │                             │
   ╰─────────────────────────────╯

error Command failed with exit code 1.

수정 방법

@types/crypto-js의 버전은 ^3.1.47입니다.
{
  ...
  "dependencies": {
    ...
    "@types/crypto-js": "^4.0.1", <- ココ
  }
}

인용하다


https://github.com/softvar/secure-ls/issues/50

좋은 웹페이지 즐겨찾기