Aha! Develop | Write extension contribution code

Aha! Develop only supports browsers that implement ECMAScript 6, also known as ES6 and ECMAScript 2015.

This means that extensions can be written in ES6 code and transpilation is not necessary for any standard JavaScript features.

During the upload process, aha-cli will process the JavaScript code. Transpilation will be performed using esbuild so that many next-generation JavaScript features can also be used. This transpilation process will also transform TypeScript into JavaScript, meaning extensions can be written in TypeScript as well as ES6. Any import statements will be resolved. Imports that refer to URLs will be loaded recursively. URL imports allow the use of an npm package CDN like Skypack. For example:

import htm from "https://cdn.pika.dev/htm@^3.0.4";

Because only a single version of React can be used on a page, any React imports will be rewritten to use the version already on Aha! Develop. Currently, this is React 16.8.4.

In most cases, there is no need for an extension to use webpack, babel, or any other build pipeline to prepare the code for upload. If it is necessary to transpile then in package.json, the entryPoint value for each extension contribution should point to the output .js file.

A single .js file can contain any number of contributions, though it is best practice to implement each contribution in a separate file. A single .js file cannot contain contributions for both browser and server code.