How To Use Es6 Import With Hyphen
Solution 1:
If that module even supports the ES6 import/export system, then what you want is this:
import source from'vinyl-source-stream';
Your version is attempting to import an exported value namedvinyl-source-stream
from the module; instead, you just want the module itself to be imported (into an object named source
in this case).
If you want everything in the module imported, instead of just the default exports, use this instead:
import * as source from'vinyl-source-stream';
But neither of those will work if the module isn't actually written to use the new system.
Solution 2:
This library doesn't use the ES2015 module system. It doesn't export
at all, so you can't import
it or from it.
This library uses the CommonJS module pattern (as can be seen in the source) and is meant to be require
ed.
You could import
the library with:
import form 'vinyl-source-stream';
which will cause the code to be executed, but that will be useless in this case since nothing (useful) will happen - in fact, you'll probably get a runtime exception due to undefined module
.
Post a Comment for "How To Use Es6 Import With Hyphen"