How to force tsc to ignore node_modules folder?












5















I'm using tsc build tasks. Unfoutunately I'm always getting the same errors from the node modules folder



Executing task: .node_modules.bintsc.cmd --watch -p .tsconfig.json <
node_modules/@types/node/index.d.ts(6208,55): error TS2304: Cannot find name 'Map'.
node_modules/@types/node/index.d.ts(6215,55): error TS2304: Cannot find name 'Set'.
node_modules/@types/node/index.d.ts(6219,64): error TS2304: Cannot find name 'Symbol'.
node_modules/@types/node/index.d.ts(6225,59): error TS2304: Cannot find name 'WeakMap'.
node_modules/@types/node/index.d.ts(6226,59): error TS2304: Cannot find name 'WeakSet'.
10:13:18 - Compilation complete. Watching for file changes.


I already added the directory to the ignore at tsconfig.json



{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"strict": false,
"noImplicitAny": false,
"strictPropertyInitialization": false,
"esModuleInterop": true,
},
"include": [
"src/*"
],
"exclude": [
"node_modules",
"./node_modules",
"./node_modules/*",
"./node_modules/@types/node/index.d.ts",
]
}


What I'm doing wrong? What should I do in order to ignore those errors?



I'm using VsCode and tsc Version 2.9.2










share|improve this question



























    5















    I'm using tsc build tasks. Unfoutunately I'm always getting the same errors from the node modules folder



    Executing task: .node_modules.bintsc.cmd --watch -p .tsconfig.json <
    node_modules/@types/node/index.d.ts(6208,55): error TS2304: Cannot find name 'Map'.
    node_modules/@types/node/index.d.ts(6215,55): error TS2304: Cannot find name 'Set'.
    node_modules/@types/node/index.d.ts(6219,64): error TS2304: Cannot find name 'Symbol'.
    node_modules/@types/node/index.d.ts(6225,59): error TS2304: Cannot find name 'WeakMap'.
    node_modules/@types/node/index.d.ts(6226,59): error TS2304: Cannot find name 'WeakSet'.
    10:13:18 - Compilation complete. Watching for file changes.


    I already added the directory to the ignore at tsconfig.json



    {
    "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "sourceMap": true,
    "strict": false,
    "noImplicitAny": false,
    "strictPropertyInitialization": false,
    "esModuleInterop": true,
    },
    "include": [
    "src/*"
    ],
    "exclude": [
    "node_modules",
    "./node_modules",
    "./node_modules/*",
    "./node_modules/@types/node/index.d.ts",
    ]
    }


    What I'm doing wrong? What should I do in order to ignore those errors?



    I'm using VsCode and tsc Version 2.9.2










    share|improve this question

























      5












      5








      5


      0






      I'm using tsc build tasks. Unfoutunately I'm always getting the same errors from the node modules folder



      Executing task: .node_modules.bintsc.cmd --watch -p .tsconfig.json <
      node_modules/@types/node/index.d.ts(6208,55): error TS2304: Cannot find name 'Map'.
      node_modules/@types/node/index.d.ts(6215,55): error TS2304: Cannot find name 'Set'.
      node_modules/@types/node/index.d.ts(6219,64): error TS2304: Cannot find name 'Symbol'.
      node_modules/@types/node/index.d.ts(6225,59): error TS2304: Cannot find name 'WeakMap'.
      node_modules/@types/node/index.d.ts(6226,59): error TS2304: Cannot find name 'WeakSet'.
      10:13:18 - Compilation complete. Watching for file changes.


      I already added the directory to the ignore at tsconfig.json



      {
      "compilerOptions": {
      "target": "es5",
      "module": "commonjs",
      "sourceMap": true,
      "strict": false,
      "noImplicitAny": false,
      "strictPropertyInitialization": false,
      "esModuleInterop": true,
      },
      "include": [
      "src/*"
      ],
      "exclude": [
      "node_modules",
      "./node_modules",
      "./node_modules/*",
      "./node_modules/@types/node/index.d.ts",
      ]
      }


      What I'm doing wrong? What should I do in order to ignore those errors?



      I'm using VsCode and tsc Version 2.9.2










      share|improve this question














      I'm using tsc build tasks. Unfoutunately I'm always getting the same errors from the node modules folder



      Executing task: .node_modules.bintsc.cmd --watch -p .tsconfig.json <
      node_modules/@types/node/index.d.ts(6208,55): error TS2304: Cannot find name 'Map'.
      node_modules/@types/node/index.d.ts(6215,55): error TS2304: Cannot find name 'Set'.
      node_modules/@types/node/index.d.ts(6219,64): error TS2304: Cannot find name 'Symbol'.
      node_modules/@types/node/index.d.ts(6225,59): error TS2304: Cannot find name 'WeakMap'.
      node_modules/@types/node/index.d.ts(6226,59): error TS2304: Cannot find name 'WeakSet'.
      10:13:18 - Compilation complete. Watching for file changes.


      I already added the directory to the ignore at tsconfig.json



      {
      "compilerOptions": {
      "target": "es5",
      "module": "commonjs",
      "sourceMap": true,
      "strict": false,
      "noImplicitAny": false,
      "strictPropertyInitialization": false,
      "esModuleInterop": true,
      },
      "include": [
      "src/*"
      ],
      "exclude": [
      "node_modules",
      "./node_modules",
      "./node_modules/*",
      "./node_modules/@types/node/index.d.ts",
      ]
      }


      What I'm doing wrong? What should I do in order to ignore those errors?



      I'm using VsCode and tsc Version 2.9.2







      node.js tsc tsconfig






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 1 '18 at 13:18









      Daniel SantosDaniel Santos

      2,33422460




      2,33422460
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Add an empty "types" option in "compilerOptions":



          {
          "compilerOptions": {
          "target": "es5",
          "module": "commonjs",
          "sourceMap": true,
          "strict": false,
          "noImplicitAny": false,
          "strictPropertyInitialization": false,
          "esModuleInterop": true,
          "types":
          },
          "include": [
          "src/*"
          ],
          "exclude": [
          "node_modules",
          "./node_modules",
          "./node_modules/*",
          "./node_modules/@types/node/index.d.ts",
          ]
          }


          From https://www.typescriptlang.org/docs/handbook/tsconfig-json.html




          @types, typeRoots and types



          By default all visible “@types” packages are included in your
          compilation. Packages in node_modules/@types of any enclosing folder
          are considered visible; specifically, that means packages within
          ./node_modules/@types/, ../node_modules/@types/,
          ../../node_modules/@types/, and so on.



          ...



          Specify "types": to disable automatic inclusion of @types packages.



          Keep in mind that automatic inclusion is only important if you’re
          using files with global declarations (as opposed to files declared as
          modules). If you use an import "foo" statement, for instance,
          TypeScript may still look through node_modules & node_modules/@types
          folders to find the foo package







          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51634361%2fhow-to-force-tsc-to-ignore-node-modules-folder%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Add an empty "types" option in "compilerOptions":



            {
            "compilerOptions": {
            "target": "es5",
            "module": "commonjs",
            "sourceMap": true,
            "strict": false,
            "noImplicitAny": false,
            "strictPropertyInitialization": false,
            "esModuleInterop": true,
            "types":
            },
            "include": [
            "src/*"
            ],
            "exclude": [
            "node_modules",
            "./node_modules",
            "./node_modules/*",
            "./node_modules/@types/node/index.d.ts",
            ]
            }


            From https://www.typescriptlang.org/docs/handbook/tsconfig-json.html




            @types, typeRoots and types



            By default all visible “@types” packages are included in your
            compilation. Packages in node_modules/@types of any enclosing folder
            are considered visible; specifically, that means packages within
            ./node_modules/@types/, ../node_modules/@types/,
            ../../node_modules/@types/, and so on.



            ...



            Specify "types": to disable automatic inclusion of @types packages.



            Keep in mind that automatic inclusion is only important if you’re
            using files with global declarations (as opposed to files declared as
            modules). If you use an import "foo" statement, for instance,
            TypeScript may still look through node_modules & node_modules/@types
            folders to find the foo package







            share|improve this answer




























              0














              Add an empty "types" option in "compilerOptions":



              {
              "compilerOptions": {
              "target": "es5",
              "module": "commonjs",
              "sourceMap": true,
              "strict": false,
              "noImplicitAny": false,
              "strictPropertyInitialization": false,
              "esModuleInterop": true,
              "types":
              },
              "include": [
              "src/*"
              ],
              "exclude": [
              "node_modules",
              "./node_modules",
              "./node_modules/*",
              "./node_modules/@types/node/index.d.ts",
              ]
              }


              From https://www.typescriptlang.org/docs/handbook/tsconfig-json.html




              @types, typeRoots and types



              By default all visible “@types” packages are included in your
              compilation. Packages in node_modules/@types of any enclosing folder
              are considered visible; specifically, that means packages within
              ./node_modules/@types/, ../node_modules/@types/,
              ../../node_modules/@types/, and so on.



              ...



              Specify "types": to disable automatic inclusion of @types packages.



              Keep in mind that automatic inclusion is only important if you’re
              using files with global declarations (as opposed to files declared as
              modules). If you use an import "foo" statement, for instance,
              TypeScript may still look through node_modules & node_modules/@types
              folders to find the foo package







              share|improve this answer


























                0












                0








                0







                Add an empty "types" option in "compilerOptions":



                {
                "compilerOptions": {
                "target": "es5",
                "module": "commonjs",
                "sourceMap": true,
                "strict": false,
                "noImplicitAny": false,
                "strictPropertyInitialization": false,
                "esModuleInterop": true,
                "types":
                },
                "include": [
                "src/*"
                ],
                "exclude": [
                "node_modules",
                "./node_modules",
                "./node_modules/*",
                "./node_modules/@types/node/index.d.ts",
                ]
                }


                From https://www.typescriptlang.org/docs/handbook/tsconfig-json.html




                @types, typeRoots and types



                By default all visible “@types” packages are included in your
                compilation. Packages in node_modules/@types of any enclosing folder
                are considered visible; specifically, that means packages within
                ./node_modules/@types/, ../node_modules/@types/,
                ../../node_modules/@types/, and so on.



                ...



                Specify "types": to disable automatic inclusion of @types packages.



                Keep in mind that automatic inclusion is only important if you’re
                using files with global declarations (as opposed to files declared as
                modules). If you use an import "foo" statement, for instance,
                TypeScript may still look through node_modules & node_modules/@types
                folders to find the foo package







                share|improve this answer













                Add an empty "types" option in "compilerOptions":



                {
                "compilerOptions": {
                "target": "es5",
                "module": "commonjs",
                "sourceMap": true,
                "strict": false,
                "noImplicitAny": false,
                "strictPropertyInitialization": false,
                "esModuleInterop": true,
                "types":
                },
                "include": [
                "src/*"
                ],
                "exclude": [
                "node_modules",
                "./node_modules",
                "./node_modules/*",
                "./node_modules/@types/node/index.d.ts",
                ]
                }


                From https://www.typescriptlang.org/docs/handbook/tsconfig-json.html




                @types, typeRoots and types



                By default all visible “@types” packages are included in your
                compilation. Packages in node_modules/@types of any enclosing folder
                are considered visible; specifically, that means packages within
                ./node_modules/@types/, ../node_modules/@types/,
                ../../node_modules/@types/, and so on.



                ...



                Specify "types": to disable automatic inclusion of @types packages.



                Keep in mind that automatic inclusion is only important if you’re
                using files with global declarations (as opposed to files declared as
                modules). If you use an import "foo" statement, for instance,
                TypeScript may still look through node_modules & node_modules/@types
                folders to find the foo package








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 20 at 15:06









                MicMic

                637




                637
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51634361%2fhow-to-force-tsc-to-ignore-node-modules-folder%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Callistus III

                    Ostreoida

                    Plistias Cous