I need to resolve ES modules, imported via static import or function-like dynamic import, in a way similar to how CJS modules in node.js
can be resolved using require.resolve(). Does anything like that exist for ES modules?
For example, if a Vue package have both vue.runtime.common.js
and vue.runtime.esm.js
. I need to get path to vue.runtime.esm.js
. If package doesn't have one, I'd like to know it.
import 'someNpmPackage'
), I don't think you will find an ES way. However, if you know what the path to the vue package will be relative to your module, you could use developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/… – Cottingham