TypeScript createLibp2p missing

When importing libp2p in a TypeScript module, many of the exports seem to be missing but when using plain JS in an ESM module it works fine.

#!/usr/bin/env ts-node
import { createLibp2p } from "libp2p"; // "libp2p": "^0.38.0"

/*
SyntaxError: Named export 'createLibp2p' not found. The requested module 'libp2p' is a CommonJS module, which may not support all module.exports as named exports.
*/
#!/usr/bin/env ts-node
import Libp2p from "libp2p";

// [class Libp2p extends EventEmitter]

My .tsconfig.json:

{
	"compilerOptions": {
		"esModuleInterop": true,
		"module": "ES2022",
		"target": "ES2022"
	},

	"ts-node": {
		"swc": true,
		"esm": true
	}
}

What is going on here? Shouldn’t the TS be getting complied down to ESM imports and therefore no different from the JS version?

Seems there must have been some conflict or version issue in my project because trying again in a new project seems to have fixed this issue. (There were some references in package-lock.json to libp2p 1.36.2.) I just had to add "moduleResolution": "node" to my .tsconfig.json.