Packages in node_modules that are published as EcmaScript Module, need to be import
ed via import ... from 'package'
or import('package')
.
You get this error when using a different way to reference the package, e. g. require()
.
Use import
or import()
to reference the package instead. (Recommended)
If you are already using import
, make sure that this is not changed by a transpiler, e. g. TypeScript or Babel.
Switch to loose mode (experimental.esmExternals: 'loose'
), which tries to automatically correct this error.