This article is more than 1 year old
Microsoft revamps Visual Studio JavaScript projects in forthcoming version
New templates will use system install for frameworks like React and Vue
Microsoft has reworked its JavaScript/TypeScript projects in the forthcoming Visual Studio 2022 to bring them more up to date with modern development.
According to the latest StackOverflow survey, Microsoft provides the two most popular Integrated Development Environments (IDEs): Visual Studio Code and in second place (but a long way behind), Visual Studio.
That survey also showed that the most popular web framework is React.js, and the most popular programming language JavaScript, which may account for why the company is now attempting to improve Visual Studio's support for React and JavaScript projects.
Visual Studio 2022, now in preview, has six new templates in this area, these being JavaScript and TypeScript variants of standalone templates for React.js, Angular, and Vue.js. When creating new projects based on these, there is an option to add starter code to call an ASP.NET Web API backend, forming a two-project solution.
On the surface, this is similar to templates that exist in Visual Studio 2019 (and which also exist in VS 2022) such as "ASP.NET Core with React.js" and "Basic Vue.js application" but there are important differences.
Program Manager Gabrielle Crevecoeur explained that "the current Angular, React, and Vue templates included with Visual Studio were often not up to date" and that JavaScript tests were not well integrated.
As if to underline the point about old versions, starting a Basic Vue.js project in Visual Studio 2019 raises a ton of warnings about deprecated and unsupported versions.
The new templates, which have an .esproj extension (standing we assume for ECMAScript Project) extension, work in a different way. Rather than relying on JavaScript/TypeScript frameworks bundled with Visual Studio, they use the version of each framework that is on the system path. If Vue is not installed, for example, a standalone Vue project cannot be created until Vue is installed globally using npm.
Whereas the old ASP.NET/React template generated a single project including both ASP.NET Core and React elements, the new approach keeps these projects separate. Another change is that the JavaScript/TypeScript projects create VS Code launch.json files automatically so that developers can open, run, and debug the application in VS Code without any further steps.
Despite Microsoft's efforts, VS Code will likely remain superior to its cousin for JavaScript and TypeScript projects, and the inclusion of the VS Code configuration file is almost an acknowledgement of that. Visual Studio is ideal for a back-end ASP.NET project, but VS Code still has advantages for JavaScript and TypeScript, being itself coded primarily in TypeScript, and having the benefit of cross-platform support, a huge community of web-oriented developers, and a more nimble development process. Visual Studio is also cross-platform for Windows and Mac to some extent, though the Mac version is not on a par with the Windows edition.
- Microsoft wonders if disabling just-in-time compilation of JavaScript improves browser security
- Stack Overflow survey: Microsoft IDEs dominate, GCP and Azure battle behind AWS
- Google Play puts Android apps on notice: No naughty JavaScript, Python, Lua
- JavaScript, GitHub, AWS crowned winners in massive survey of 32,000 developers
That said, the effort to have Visual Studio use system version of these JavaScript frameworks makes sense, especially since they have a rapid pace of development and it is hard for Visual Studio to keep up.
[The current development approach for JavaScript applications is a] massive tumor of complexity
Ruby on Rails inventor David Heinemeier Hansson said last week that the current development approach for JavaScript applications, in which source code is transpiled and optimised by a tool like webpack (this is how the Create React script called by Visual Studio works), is a "massive tumor of complexity."
He said: "ES6 is now supported by all browsers that matter. Chrome, Edge, Safari, and Firefox fully support ES6. The last major hold out was IE11, but Microsoft mercifully announced its end of life this year. This means we don't need a transpiling step to turn ES6 into something that'll run in the browser. It runs just fine, no changes needed."
He said the Rails team was therefore working on cutting it all out, though he added that React relies on transpiling for its JSX files.
Hansson's comments illustrate how web development continues to evolve and show the good sense in the Visual Studio team decoupling JavaScript and TypeScript project creation from the IDE as far as possible. ®