For example, I'm developing next.js application and use library including epub.js in it.
Next.js can compile typescript or esm so, we can use epubjs directly in Next.js application as reading esm format, but,
can't usually do it in node_modules without babel transpile configuration because next.js's webpack setting skip transpiling js when module entrypoint's commonjs format .
For example,
My library output commonjs module and contains require('epubjs').default or some codes as programmatically evaluated equals the line. So, when we import this module, internal this, epubjs interpreted as commonjs and error happens when reading this, because it implements esm module code nevertheless it is commonjs module.
This line causes error of ESM format like above contaminated to commonjs module because this script isn't builded commonjs format until providing it at npm.
Thus, we need some patch to babel transpilation config including node_modules and it can be complex as it should be.
Now, I use version 0.3.73 and everything work fine in this version without any transpile setting.
I really love and appreciate it to publish as OSS. So, I request some module format's compatibility feature.
From version 0.3.88, https://github.com/futurepress/epub.js/blob/master/libs/mime/mime.js#L169 is changed to esm module, and this have possibility to break library using epubjs.
For example, I'm developing next.js application and use library including epub.js in it. Next.js can compile typescript or esm so, we can use epubjs directly in Next.js application as reading esm format, but, can't usually do it in node_modules without babel transpile configuration because next.js's webpack setting skip transpiling js when module entrypoint's commonjs format .
For example, My library output commonjs module and contains
require('epubjs').default
or some codes as programmatically evaluated equals the line. So, when we import this module, internal this, epubjs interpreted as commonjs and error happens when reading this, because it implements esm module code nevertheless it is commonjs module.This line causes error of ESM format like above contaminated to commonjs module because this script isn't builded commonjs format until providing it at npm. Thus, we need some patch to babel transpilation config including node_modules and it can be complex as it should be.
Now, I use version 0.3.73 and everything work fine in this version without any transpile setting.
regard.