Can I use ES Modules?

Is it possible to use ES Modules and how?

Sort of:

const Homey = require('homey');

module.exports = class MyApp extends Homey.app {
  async onInit() {
    this.myModule = await import('./my-module.mjs');
  }
}

Thank you! Yeah that works, but unfortunately not works with TypeScript, because when Homey make build Typescript replaces import() to require(), how it can be fixed?

I would like to use CommonJS modules as well as one ES module together, using Typescript, what should I add to tsconfig file?

Yes, I know thank you, but I’m always not very good with the TS setting, so could you suggest ready-made values for “module”:

I don’t develop Homey apps in TS because the SDK TS typings are pretty much broken, so I don’t have an out-of-the-box example for you.