html-express-js icon indicating copy to clipboard operation
html-express-js copied to clipboard

Use with express - which is ES5

Open mitra42 opened this issue 1 year ago • 4 comments

I'm trying to figure out if this is usable during this weird interim time when ES5 and ES6 have to co-exist.

I may have made some mistaken assumptions in my explanation below...

html-express-js seems to require ES6 - i.e. "import" - this is also what its docs show, and require('html-express-js') doesn't work express seems to be ES5 - all its documentation shows 'require', even if express will work as a module many other things around it that I'm using won't (yet), so my "Main.js" is ES5 and uses require.

This doesn't need to be a problem - as could probably use what I believe are called "ES5 dynamic imports"

const htmlExpress = import('html-express-js') 

except html-express-js exports both default and named functions, and I don't think its possible to see them via dynamic imports.

Maybe this is obvious to others, but I can't figure out the trick to get this to work in ES5 so maybe an addition to the README.md would be useful if I'm missing something.

mitra42 avatar May 04 '23 01:05 mitra42