Failed to compile. sandwich-stream.mjs


#1

Failed to compile.

./node_modules/sandwich-stream/dist/sandwich-stream.mjs
Can’t import the named export ‘Readable’ from non EcmaScript module (only default export is available)


#2

Hi,

I did some research and found out that .mjs files seem to cause problem in CRA projects generally. I’m not sure what would be the proper fix but something like this seemed to work:

import SandwichStream from 'sandwich-stream/dist/sandwich-stream.js';

Based on that the related plugin code would look like this:

this.getReactWebImports = function(exporter) {
  return [
    { varName: "SandwichStream", path: "sandwich-stream/dist/sandwich-stream.js" },
  ];
}