Using ESM in Homey Apps
CommonJS vs. ESM
CJS Example:
'use strict';
const Homey = require('homey');
class MyApp extends Homey.App {
async onInit() {
this.log('MyApp has been initialized');
}
}
module.exports = MyApp;ESM Example:
import Homey from 'homey';
class MyApp extends Homey.App {
async onInit() {
this.log('MyApp has been initialized');
}
}
export default MyApp;
Using .mjs
.mjsMigrating from CommonJS to ESM
Common Gotchas and Compatibility
Benefits of Using ESM
Last updated
Was this helpful?