I'm using tsyringe in Node.js >= 12 with the ESM module loader enabled. I would like to use named exports of tsyringe but I'm not able to do so:
import { container } from 'tsyringe';
^^^^^^^^^
SyntaxError: The requested module 'tsyringe' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'tsyringe';
const { container } = pkg;
Problem
I'm using tsyringe in Node.js >= 12 with the ESM module loader enabled. I would like to use named exports of tsyringe but I'm not able to do so:
My
tsconfig.json
looks like:Description
Having a release published as ES 6 module (
"type": "module"
) would help.