Angular 7 | Build --aot fails | Typescript .d.ts declaration files missing from compilation












0














I am currently struggling to build my Angular 7 app (recently updated from v6).



Running ng build works fine, however, either ng serve --aot, ng build --aot or ng build --prod (which enables aot as well) causes the error below.



The Typescript compiler fails to find my own .d.ts files all located in src/app/types/.



I tried to solve the issue by adding the path to these files to the include property of the tsconfig.app.json file, but it did not work.



Please note that the issue was the same with Angular v6.



ERROR in ./src/app/types/data.d.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: /xxx/src/app/types/data.d.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (/xxxx/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:767:23)
at plugin.done.then (/xxxx/node_modules/@ngtools/webpack/src/loader.js:41:31)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)


Here is the tsconfig.json file :



{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}


Here is the tsconfig.app.json file :



{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": ["node"]
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}


Can you please help me resolve this issue ?
Thanks.










share|improve this question





























    0














    I am currently struggling to build my Angular 7 app (recently updated from v6).



    Running ng build works fine, however, either ng serve --aot, ng build --aot or ng build --prod (which enables aot as well) causes the error below.



    The Typescript compiler fails to find my own .d.ts files all located in src/app/types/.



    I tried to solve the issue by adding the path to these files to the include property of the tsconfig.app.json file, but it did not work.



    Please note that the issue was the same with Angular v6.



    ERROR in ./src/app/types/data.d.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /xxx/src/app/types/data.d.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/xxxx/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:767:23)
    at plugin.done.then (/xxxx/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)


    Here is the tsconfig.json file :



    {
    "compileOnSave": false,
    "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
    "node_modules/@types"
    ],
    "lib": [
    "es2017",
    "dom"
    ]
    }
    }


    Here is the tsconfig.app.json file :



    {
    "extends": "../tsconfig.json",
    "compilerOptions": {
    "outDir": "../out-tsc/app",
    "types": ["node"]
    },
    "exclude": [
    "src/test.ts",
    "**/*.spec.ts"
    ]
    }


    Can you please help me resolve this issue ?
    Thanks.










    share|improve this question



























      0












      0








      0







      I am currently struggling to build my Angular 7 app (recently updated from v6).



      Running ng build works fine, however, either ng serve --aot, ng build --aot or ng build --prod (which enables aot as well) causes the error below.



      The Typescript compiler fails to find my own .d.ts files all located in src/app/types/.



      I tried to solve the issue by adding the path to these files to the include property of the tsconfig.app.json file, but it did not work.



      Please note that the issue was the same with Angular v6.



      ERROR in ./src/app/types/data.d.ts
      Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
      Error: /xxx/src/app/types/data.d.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
      at AngularCompilerPlugin.getCompiledFile (/xxxx/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:767:23)
      at plugin.done.then (/xxxx/node_modules/@ngtools/webpack/src/loader.js:41:31)
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:188:7)


      Here is the tsconfig.json file :



      {
      "compileOnSave": false,
      "compilerOptions": {
      "baseUrl": "./",
      "outDir": "./dist/out-tsc",
      "sourceMap": true,
      "declaration": false,
      "module": "es2015",
      "moduleResolution": "node",
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "target": "es5",
      "typeRoots": [
      "node_modules/@types"
      ],
      "lib": [
      "es2017",
      "dom"
      ]
      }
      }


      Here is the tsconfig.app.json file :



      {
      "extends": "../tsconfig.json",
      "compilerOptions": {
      "outDir": "../out-tsc/app",
      "types": ["node"]
      },
      "exclude": [
      "src/test.ts",
      "**/*.spec.ts"
      ]
      }


      Can you please help me resolve this issue ?
      Thanks.










      share|improve this question















      I am currently struggling to build my Angular 7 app (recently updated from v6).



      Running ng build works fine, however, either ng serve --aot, ng build --aot or ng build --prod (which enables aot as well) causes the error below.



      The Typescript compiler fails to find my own .d.ts files all located in src/app/types/.



      I tried to solve the issue by adding the path to these files to the include property of the tsconfig.app.json file, but it did not work.



      Please note that the issue was the same with Angular v6.



      ERROR in ./src/app/types/data.d.ts
      Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
      Error: /xxx/src/app/types/data.d.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
      at AngularCompilerPlugin.getCompiledFile (/xxxx/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:767:23)
      at plugin.done.then (/xxxx/node_modules/@ngtools/webpack/src/loader.js:41:31)
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:188:7)


      Here is the tsconfig.json file :



      {
      "compileOnSave": false,
      "compilerOptions": {
      "baseUrl": "./",
      "outDir": "./dist/out-tsc",
      "sourceMap": true,
      "declaration": false,
      "module": "es2015",
      "moduleResolution": "node",
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "target": "es5",
      "typeRoots": [
      "node_modules/@types"
      ],
      "lib": [
      "es2017",
      "dom"
      ]
      }
      }


      Here is the tsconfig.app.json file :



      {
      "extends": "../tsconfig.json",
      "compilerOptions": {
      "outDir": "../out-tsc/app",
      "types": ["node"]
      },
      "exclude": [
      "src/test.ts",
      "**/*.spec.ts"
      ]
      }


      Can you please help me resolve this issue ?
      Thanks.







      angular typescript build angular7






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 10 '18 at 19:45









      Goncalo Peres

      1,3261318




      1,3261318










      asked Nov 21 '18 at 19:25









      LudoZikLudoZik

      7641617




      7641617
























          2 Answers
          2






          active

          oldest

          votes


















          0














          I found the solution to my problem :
          I checked all the import statements of the .d.ts files everywhere in my app.
          One was wrong (wrong path) , which did not seem to be an issue without the --aot flag.
          Maybe that will help someone.






          share|improve this answer





























            -2














            Change the types key to typeRoots in your tsconfig.app.json since you are specifying a folder instead of specific files.






            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%2f53419242%2fangular-7-build-aot-fails-typescript-d-ts-declaration-files-missing-from%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              I found the solution to my problem :
              I checked all the import statements of the .d.ts files everywhere in my app.
              One was wrong (wrong path) , which did not seem to be an issue without the --aot flag.
              Maybe that will help someone.






              share|improve this answer


























                0














                I found the solution to my problem :
                I checked all the import statements of the .d.ts files everywhere in my app.
                One was wrong (wrong path) , which did not seem to be an issue without the --aot flag.
                Maybe that will help someone.






                share|improve this answer
























                  0












                  0








                  0






                  I found the solution to my problem :
                  I checked all the import statements of the .d.ts files everywhere in my app.
                  One was wrong (wrong path) , which did not seem to be an issue without the --aot flag.
                  Maybe that will help someone.






                  share|improve this answer












                  I found the solution to my problem :
                  I checked all the import statements of the .d.ts files everywhere in my app.
                  One was wrong (wrong path) , which did not seem to be an issue without the --aot flag.
                  Maybe that will help someone.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 26 '18 at 11:58









                  LudoZikLudoZik

                  7641617




                  7641617

























                      -2














                      Change the types key to typeRoots in your tsconfig.app.json since you are specifying a folder instead of specific files.






                      share|improve this answer


























                        -2














                        Change the types key to typeRoots in your tsconfig.app.json since you are specifying a folder instead of specific files.






                        share|improve this answer
























                          -2












                          -2








                          -2






                          Change the types key to typeRoots in your tsconfig.app.json since you are specifying a folder instead of specific files.






                          share|improve this answer












                          Change the types key to typeRoots in your tsconfig.app.json since you are specifying a folder instead of specific files.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 21 '18 at 21:19









                          Vapour in the AlleyVapour in the Alley

                          33936




                          33936






























                              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.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • 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%2f53419242%2fangular-7-build-aot-fails-typescript-d-ts-declaration-files-missing-from%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

                              Feedback on college project

                              Futebolista

                              Albești (Vaslui)