egg icon indicating copy to clipboard operation
egg copied to clipboard

EggJS was supporting ESM ?

Open phatify opened this issue 3 years ago • 1 comments

Can i use ES6 syntax, import ... from ... and export default ... in EggJS ?

phatify avatar Dec 23 '21 08:12 phatify

for controllers/services, I'm sorry, can't write by ESM now, due to egg 2.0 loader is using require to load file. for thrid npm modules, you could use await import().

egg 3.0 will support ESM at session 1 of this year. for now, you could try to write with TS and compile it to CommonJS.

atian25 avatar Dec 25 '21 05:12 atian25