locked
Asp .Net core MPA with vue.js TypeScript RRS feed

  • Question

  • User-824531797 posted

    Hello

    Looking to use jquery + vue.js in a ASP .NET core MPA.

    Also looking to migrate towards TypeScript for both jQuery and vue.js.

    Need a sample project which can get us started for above.

    Thanks

    Friday, May 21, 2021 12:44 PM

All replies

  • User475983607 posted

    Vue is an more robust and modern alternative to jQuery.  It does not make a lot of sense to implement jQuery within a Vue application.   What jQuery feature do you need that Vue does not support?

    Friday, May 21, 2021 1:02 PM
  • User-824531797 posted

    Ok. Suppose we leave aside jquery for now.

    Is there a sample project which shows Asp .net Core MPA App with vue.js in TypeScript ?

    Thanks

    Friday, May 21, 2021 2:43 PM
  • User-474980206 posted

    To use typescript and MPA will make the project more difficult, as typescript will require transpiling. also using typescript you probably want module support.

    You will not be able to use the vue cli, so you will need to create you own webpack config, that has an output for each page. 

    if you want start with the cli, you could create a folder for each page, and separate node project for each page in the folder. Each page  project will generate its own index page. You could debug each page standalone. Then you will need a deployment step in the msbuild and and custom static file handler to map the request to the pagefolder/build/ structure. 

    as vue.js is a client technology, find any MPA examples. You asp.net core will be a simple html source and webapi. 

    Friday, May 21, 2021 3:01 PM
  • User-824531797 posted

    So does this mean TypeScript is not available to Asp .Net Core MPA projects ?

    Just want a JS library which can work with Asp .Net Core MPA, can be coded in TypeScript, and can do data binding.

    Friday, May 21, 2021 3:34 PM
  • User-474980206 posted

    when you pick typescript as source language, you need to pick a toolchain to transpile the typescript to javascript. most are node based. you can pick babel or tcl. You may also want client build tools like webpack, grunt or gulp. visual studio has extensions for all these tools, and msbuild can execute  a client build tool.

    here is a sample using a folder structure: 

      https://github.com/wandersonpjbkn/vue-mpa-application-example

    put source as root folder (ClientApp is the asp.net core convention) in the asp.net core project, and use the static or spa file handler to expose the build folder. 

     

    Friday, May 21, 2021 6:56 PM