@ngtools/webpack does not build by entrypoint imports











up vote
0
down vote

favorite












I use @ngtools/webpack directly in angular-app (withou angular-cli) and i got unexpected behavior. Aot plugin build all ts-files in project, but some files not imported by entrypoint file (main.ts). For expample - ts-loader build only files that find by imports in entrypoint file (main.ts). This is bug or feature?



I created mini-repo: https://github.com/alxpsr/ngtools-unexpected
Run npm run build:aot and you got an error. But if you run npm run build:tsloader - the build will not have an error.



If this is not a bug, please tell me what the difference between this two builds?



P.S. I know about files and include option in tsconfig.json and i can specify files more clearly there. I want to understand the differences between these two builds. ^_^










share|improve this question


























    up vote
    0
    down vote

    favorite












    I use @ngtools/webpack directly in angular-app (withou angular-cli) and i got unexpected behavior. Aot plugin build all ts-files in project, but some files not imported by entrypoint file (main.ts). For expample - ts-loader build only files that find by imports in entrypoint file (main.ts). This is bug or feature?



    I created mini-repo: https://github.com/alxpsr/ngtools-unexpected
    Run npm run build:aot and you got an error. But if you run npm run build:tsloader - the build will not have an error.



    If this is not a bug, please tell me what the difference between this two builds?



    P.S. I know about files and include option in tsconfig.json and i can specify files more clearly there. I want to understand the differences between these two builds. ^_^










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I use @ngtools/webpack directly in angular-app (withou angular-cli) and i got unexpected behavior. Aot plugin build all ts-files in project, but some files not imported by entrypoint file (main.ts). For expample - ts-loader build only files that find by imports in entrypoint file (main.ts). This is bug or feature?



      I created mini-repo: https://github.com/alxpsr/ngtools-unexpected
      Run npm run build:aot and you got an error. But if you run npm run build:tsloader - the build will not have an error.



      If this is not a bug, please tell me what the difference between this two builds?



      P.S. I know about files and include option in tsconfig.json and i can specify files more clearly there. I want to understand the differences between these two builds. ^_^










      share|improve this question













      I use @ngtools/webpack directly in angular-app (withou angular-cli) and i got unexpected behavior. Aot plugin build all ts-files in project, but some files not imported by entrypoint file (main.ts). For expample - ts-loader build only files that find by imports in entrypoint file (main.ts). This is bug or feature?



      I created mini-repo: https://github.com/alxpsr/ngtools-unexpected
      Run npm run build:aot and you got an error. But if you run npm run build:tsloader - the build will not have an error.



      If this is not a bug, please tell me what the difference between this two builds?



      P.S. I know about files and include option in tsconfig.json and i can specify files more clearly there. I want to understand the differences between these two builds. ^_^







      angular aot ngtools






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 10 at 14:39









      Alxpsr

      11




      11
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Both the builds are different. When building using AOT, the code is compiled using the angular compiler. It compiles all your code before deploying so the client-browser doesn't have to do much work. For example, if you have called a function in HTML, but don't have the function defined in your component, the Angular Compiler will give you error while building the app itself.



          On the other hand, when you build using tsloader, the build succeeds, but the app breaks on runtime when you encounter such an error.






          share|improve this answer





















          • Yes, thank you. But i don't understand why ts-loader compiler step by step by imports, when ngtools compile whole project.
            – Alxpsr
            2 days ago










          • Its not the ngtools, but the Angular compiler plugin that you are using which makes the difference. The tsloader also compiles the complete project, ignoring the HTML error, such as incorrect tag ending, function call.
            – Sachin Gupta
            2 days ago











          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',
          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%2f53240009%2fngtools-webpack-does-not-build-by-entrypoint-imports%23new-answer', 'question_page');
          }
          );

          Post as a guest
































          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          Both the builds are different. When building using AOT, the code is compiled using the angular compiler. It compiles all your code before deploying so the client-browser doesn't have to do much work. For example, if you have called a function in HTML, but don't have the function defined in your component, the Angular Compiler will give you error while building the app itself.



          On the other hand, when you build using tsloader, the build succeeds, but the app breaks on runtime when you encounter such an error.






          share|improve this answer





















          • Yes, thank you. But i don't understand why ts-loader compiler step by step by imports, when ngtools compile whole project.
            – Alxpsr
            2 days ago










          • Its not the ngtools, but the Angular compiler plugin that you are using which makes the difference. The tsloader also compiles the complete project, ignoring the HTML error, such as incorrect tag ending, function call.
            – Sachin Gupta
            2 days ago















          up vote
          0
          down vote













          Both the builds are different. When building using AOT, the code is compiled using the angular compiler. It compiles all your code before deploying so the client-browser doesn't have to do much work. For example, if you have called a function in HTML, but don't have the function defined in your component, the Angular Compiler will give you error while building the app itself.



          On the other hand, when you build using tsloader, the build succeeds, but the app breaks on runtime when you encounter such an error.






          share|improve this answer





















          • Yes, thank you. But i don't understand why ts-loader compiler step by step by imports, when ngtools compile whole project.
            – Alxpsr
            2 days ago










          • Its not the ngtools, but the Angular compiler plugin that you are using which makes the difference. The tsloader also compiles the complete project, ignoring the HTML error, such as incorrect tag ending, function call.
            – Sachin Gupta
            2 days ago













          up vote
          0
          down vote










          up vote
          0
          down vote









          Both the builds are different. When building using AOT, the code is compiled using the angular compiler. It compiles all your code before deploying so the client-browser doesn't have to do much work. For example, if you have called a function in HTML, but don't have the function defined in your component, the Angular Compiler will give you error while building the app itself.



          On the other hand, when you build using tsloader, the build succeeds, but the app breaks on runtime when you encounter such an error.






          share|improve this answer












          Both the builds are different. When building using AOT, the code is compiled using the angular compiler. It compiles all your code before deploying so the client-browser doesn't have to do much work. For example, if you have called a function in HTML, but don't have the function defined in your component, the Angular Compiler will give you error while building the app itself.



          On the other hand, when you build using tsloader, the build succeeds, but the app breaks on runtime when you encounter such an error.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 10 at 15:25









          Sachin Gupta

          26416




          26416












          • Yes, thank you. But i don't understand why ts-loader compiler step by step by imports, when ngtools compile whole project.
            – Alxpsr
            2 days ago










          • Its not the ngtools, but the Angular compiler plugin that you are using which makes the difference. The tsloader also compiles the complete project, ignoring the HTML error, such as incorrect tag ending, function call.
            – Sachin Gupta
            2 days ago


















          • Yes, thank you. But i don't understand why ts-loader compiler step by step by imports, when ngtools compile whole project.
            – Alxpsr
            2 days ago










          • Its not the ngtools, but the Angular compiler plugin that you are using which makes the difference. The tsloader also compiles the complete project, ignoring the HTML error, such as incorrect tag ending, function call.
            – Sachin Gupta
            2 days ago
















          Yes, thank you. But i don't understand why ts-loader compiler step by step by imports, when ngtools compile whole project.
          – Alxpsr
          2 days ago




          Yes, thank you. But i don't understand why ts-loader compiler step by step by imports, when ngtools compile whole project.
          – Alxpsr
          2 days ago












          Its not the ngtools, but the Angular compiler plugin that you are using which makes the difference. The tsloader also compiles the complete project, ignoring the HTML error, such as incorrect tag ending, function call.
          – Sachin Gupta
          2 days ago




          Its not the ngtools, but the Angular compiler plugin that you are using which makes the difference. The tsloader also compiles the complete project, ignoring the HTML error, such as incorrect tag ending, function call.
          – Sachin Gupta
          2 days ago


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240009%2fngtools-webpack-does-not-build-by-entrypoint-imports%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          Popular posts from this blog

          Bressuire

          Vorschmack

          Quarantine