evilz / vscode-reveal

Revealjs vsCode extension
https://marketplace.visualstudio.com/items?itemName=evilz.vscode-reveal
MIT License
460 stars 147 forks source link

handle custom init in ESM format #1083

Open qbikez opened 2 years ago

qbikez commented 2 years ago

Custom init script is very useful, but it lacked the support for module type scripts. Modules make it possible to import other files, so you don't have to put all the code into init.js.

This PR adds handling of init.esm.js script as type=module.

evilz commented 2 years ago

Why do you need this ?

qbikez commented 2 years ago

I wanted to use a custom plugin, but didn't find a way to include js files other than init.js. I wanted to keep things modular and not put everything into init.js and wanted to avoid any additional build steps. At first, I added a custom list of js files to libs.ejs, the same way custom css is done. But then I realized I could use ECMAScript modules and have nice, modern imports.

evilz commented 2 years ago

Ok cool I see