BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News JS Foundation Releases Dojo 5

JS Foundation Releases Dojo 5

At the end of January, Dojo, a progressive framework for modern web applications, released Dojo 5. Dojo 5 brings a significant number of bug fixes and improvements in features and tooling. Dojo 5 may produce smaller bundles due to a smarter management of polyfills, facilitates an easier build and development experience with an improved CLI, streamlines testing of view templates, and leverages the latest version of TypeScript. This iteration aims at enabling developers to ship faster, smaller and more robust code base to more browsers.

Dojo 5 seeks to improve performance by serving less JavaScript. It does so by optimizing bundling and loading of polyfills. If an application does not use a polyfilled browser feature, it will not load the corresponding polyfill. Alternatively, if the target browser has native support for the polyfilled feature, the polyfill will not be included.

Dojo 5 also provides a collection of shims with additional polyfills for features such as Fetch, Intersection Observer, Web Animations, and Resize Observer. Those polyfills need not be explicitly included in a Dojo application.

Additionally, the new Dojo Blocks feature allows executing computations in Node.js at build time. The result of such computations is then made available at runtime in the browser. Some build operations, which would previously require non-standard technologies and a possibly complex configuration, may now be performed leveraging only JavaScript.

The new Assertion Templates aims at making unit testing Dojo widgets easier. Because Dojo uses a virtual DOM, testing what a widget renders may mean testing against an opaque Dojo-specific data structure. With Assertion Templates, Dojo developers need not understand Dojo virtual DOM implementation details. Instead, they can write assertions comparing an actual template against an expected template.

With Dojo 5, middlewares for Dojo stores can now run not only after state update operations, but also before such updates happens. The extra functionality may enable to add useful custom features to stores, such as caching capability.

Dojo 5 also provides extended build-time routing support, simplified the operation of its development server, and supports TypeScript versions from 2.6.x to 3.2.x.

Most users should be able to migrate to Dojo 5 by installing the latest version of @dojo/cli-upgrade-app, and running the following command: dojo upgrade app. Dojo also made available an in-depth migration guide. The Dojo team will additionally host a few free live workshops. The first workshop is scheduled to be in London on May 1st. Developers may review Dojo examples available in code playgrounds, the updated documentation and the dedicated GitHub repository.

Dojo 2 was a major rewrite of Dojo. The rewrite sought to enable developers to build modern applications by leveraging modern standards and best practices which have seen significant adoption over the last few years. As such, Dojo 2 embraced TypeScript, a component-based architecture, a reactive virtual DOM, CSS modules, Build Time Rendering, and baked in support for internationalization and accessibility. It also included more and better tooling, including a new Command Line Interface (CLI). Dojo 2 notably supported interoperability between frameworks by allowing importing and exporting from and to web components.

The RealWorld-based benchmark ranked Dojo 2 among the top three contenders on the first meaningful paint and bundle transfer size metrics. On the other hand, the Dojo 2 app also exhibited the second largest code base. The RealWorld app is a fullstack Medium.com clone which has been implemented with a large variety of front-end and back-end technologies. It allows to compare 13 frameworks by comparing competing implementations of an application of a larger complexity and size than is usual in other popular benchmarks. Developers, as customary, ought to extrapolate benchmark results with care.

Dojo 3 and 4 further consolidated core packages into a single framework package, and continued to expand and improve on tooling. Those releases also introduced a faster VDOM engine, and abstractions for better routing and state management.

Dojo is an open source project available under the new BSD license. It is supported by the JS Foundation, an organization that also supports key JavaScript projects like jQuery, webpack, and lodash with legal and governance support. Significant contributions to Dojo are made by SitePen. Developers interested in contributing to the development of Dojo can find contribution guidelines and a code of conduct on the Dojo GitHub project. Developers looking to use or contribute to Dojo may also connect with the Dojo team and community on Discord.

Rate this Article

Adoption
Style

BT