How can I use optionalDependencies with import/export syntax?
Specifically, the example they give on npmjs.org shows:
try {
var foo = require('foo')
var fooVersion = require('foo/package.json').version
} catch (er) {
foo = null
}
But import won't work inside a try block. What's the recommended way to conditionally require modules using ES6-modules syntax?
via mpen
No comments:
Post a Comment