Using Webpack in ASP.net webforms application: Namespaces, Modules, Typings, and Compiling











up vote
0
down vote

favorite












I am trying to introduce webpack in an ASP.net web forms application using visual studio.



Having turned off the VS TypeScript compiler using this property group:



<PropertyGroup>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
</PropertyGroup>


I have come across countless issues in order to get this working, and I still haven't.



First of all the compiler and IDE no longer recognise the typings for jQuery and other libraries.



I have read about a few solutions which have suggested using the "include", "typeRoot" and "types" properties in the tsconfig file.



When I specify values for "typeRoot" and "types" like so:



"typeRoots": [
"./node_modules/@types",
"./Scripts/typings"
],
"types": [
"node",
"jquery",
"jqueryui",


Still when I run the build command the compiler throws a bunch of errors:
TS2304: Cannot find name '$'.
TS2304: Cannot find name 'jQuery'.



The types and libraries all do exist in the application. Before, Visual Studio recognised these automatically without having to specify any sort of configuration like above.



Now on introducing webpack and NPM in the project, every ts file has a bunch of errors and all TypeScript namespaces and modules also error.



Why is this the case?



In order to resolve this, I'd have to add a reference path in every file like so for typings and any namespace or module.



/// <reference path="./typings/jquery/jquery.d.ts" />
/// <reference path="./Modules/MyModule.ts" />


I have tried all sorts to resolve this issues, even adding a _resource.ts file didn't work as the IDE still did not recognise this file - in the root directory.



How can I get the IDE to recognise the types, namespaces, and modules without manually adding in each and every file and get the compiler to compile successfully?



Even when I add these to "include" property in the tsconfig, the IDE still complains with the error cannot find....










share|improve this question




























    up vote
    0
    down vote

    favorite












    I am trying to introduce webpack in an ASP.net web forms application using visual studio.



    Having turned off the VS TypeScript compiler using this property group:



    <PropertyGroup>
    <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
    </PropertyGroup>


    I have come across countless issues in order to get this working, and I still haven't.



    First of all the compiler and IDE no longer recognise the typings for jQuery and other libraries.



    I have read about a few solutions which have suggested using the "include", "typeRoot" and "types" properties in the tsconfig file.



    When I specify values for "typeRoot" and "types" like so:



    "typeRoots": [
    "./node_modules/@types",
    "./Scripts/typings"
    ],
    "types": [
    "node",
    "jquery",
    "jqueryui",


    Still when I run the build command the compiler throws a bunch of errors:
    TS2304: Cannot find name '$'.
    TS2304: Cannot find name 'jQuery'.



    The types and libraries all do exist in the application. Before, Visual Studio recognised these automatically without having to specify any sort of configuration like above.



    Now on introducing webpack and NPM in the project, every ts file has a bunch of errors and all TypeScript namespaces and modules also error.



    Why is this the case?



    In order to resolve this, I'd have to add a reference path in every file like so for typings and any namespace or module.



    /// <reference path="./typings/jquery/jquery.d.ts" />
    /// <reference path="./Modules/MyModule.ts" />


    I have tried all sorts to resolve this issues, even adding a _resource.ts file didn't work as the IDE still did not recognise this file - in the root directory.



    How can I get the IDE to recognise the types, namespaces, and modules without manually adding in each and every file and get the compiler to compile successfully?



    Even when I add these to "include" property in the tsconfig, the IDE still complains with the error cannot find....










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am trying to introduce webpack in an ASP.net web forms application using visual studio.



      Having turned off the VS TypeScript compiler using this property group:



      <PropertyGroup>
      <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
      </PropertyGroup>


      I have come across countless issues in order to get this working, and I still haven't.



      First of all the compiler and IDE no longer recognise the typings for jQuery and other libraries.



      I have read about a few solutions which have suggested using the "include", "typeRoot" and "types" properties in the tsconfig file.



      When I specify values for "typeRoot" and "types" like so:



      "typeRoots": [
      "./node_modules/@types",
      "./Scripts/typings"
      ],
      "types": [
      "node",
      "jquery",
      "jqueryui",


      Still when I run the build command the compiler throws a bunch of errors:
      TS2304: Cannot find name '$'.
      TS2304: Cannot find name 'jQuery'.



      The types and libraries all do exist in the application. Before, Visual Studio recognised these automatically without having to specify any sort of configuration like above.



      Now on introducing webpack and NPM in the project, every ts file has a bunch of errors and all TypeScript namespaces and modules also error.



      Why is this the case?



      In order to resolve this, I'd have to add a reference path in every file like so for typings and any namespace or module.



      /// <reference path="./typings/jquery/jquery.d.ts" />
      /// <reference path="./Modules/MyModule.ts" />


      I have tried all sorts to resolve this issues, even adding a _resource.ts file didn't work as the IDE still did not recognise this file - in the root directory.



      How can I get the IDE to recognise the types, namespaces, and modules without manually adding in each and every file and get the compiler to compile successfully?



      Even when I add these to "include" property in the tsconfig, the IDE still complains with the error cannot find....










      share|improve this question















      I am trying to introduce webpack in an ASP.net web forms application using visual studio.



      Having turned off the VS TypeScript compiler using this property group:



      <PropertyGroup>
      <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
      </PropertyGroup>


      I have come across countless issues in order to get this working, and I still haven't.



      First of all the compiler and IDE no longer recognise the typings for jQuery and other libraries.



      I have read about a few solutions which have suggested using the "include", "typeRoot" and "types" properties in the tsconfig file.



      When I specify values for "typeRoot" and "types" like so:



      "typeRoots": [
      "./node_modules/@types",
      "./Scripts/typings"
      ],
      "types": [
      "node",
      "jquery",
      "jqueryui",


      Still when I run the build command the compiler throws a bunch of errors:
      TS2304: Cannot find name '$'.
      TS2304: Cannot find name 'jQuery'.



      The types and libraries all do exist in the application. Before, Visual Studio recognised these automatically without having to specify any sort of configuration like above.



      Now on introducing webpack and NPM in the project, every ts file has a bunch of errors and all TypeScript namespaces and modules also error.



      Why is this the case?



      In order to resolve this, I'd have to add a reference path in every file like so for typings and any namespace or module.



      /// <reference path="./typings/jquery/jquery.d.ts" />
      /// <reference path="./Modules/MyModule.ts" />


      I have tried all sorts to resolve this issues, even adding a _resource.ts file didn't work as the IDE still did not recognise this file - in the root directory.



      How can I get the IDE to recognise the types, namespaces, and modules without manually adding in each and every file and get the compiler to compile successfully?



      Even when I add these to "include" property in the tsconfig, the IDE still complains with the error cannot find....







      asp.net typescript npm webpack webforms






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 11 at 13:07









      Zoe

      10.7k73575




      10.7k73575










      asked Nov 11 at 12:28









      Chief

      4819




      4819





























          active

          oldest

          votes











          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%2f53248765%2fusing-webpack-in-asp-net-webforms-application-namespaces-modules-typings-and%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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%2f53248765%2fusing-webpack-in-asp-net-webforms-application-namespaces-modules-typings-and%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

          Florida Star v. B. J. F.

          Danny Elfman

          Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues