Requiring a JavaScript Node.js module in TypeScript (allowJs' is not set)

前端 未结 1 592
别跟我提以往
别跟我提以往 2020-12-15 19:22

I have an Angular2 app inside Electron. Now, I would like to use the @pokusew/pcsclite library to use NFC functionality. This library uses native Node.js module

1条回答
  •  悲&欢浪女
    2020-12-15 20:05

    Add the allowJs option in your tsconfig.json like this:
    as fabian lauer said also add outDir option to specify where your compiled files will be:

    {
        "compilerOptions": {
            "outDir": "./built", <--- add this
            "allowJs": true,  <--- and this
            "target": "es5"
        },
        "include": [
            "./src/**/*"
        ]
    }
    

    0 讨论(0)
提交回复
热议问题