Skip to content
On this page

How to use the library without ESM?

The library is a pure ESM package. Sindre Sorhus has written a great help page if you are new to ESM packages.

If you don't use or can't use ESM, you can use the asynchronous import function.

const { createAvatar } = await import('@dicebear/core');
const { lorelei } = await import('@dicebear/collection');

const avatar = createAvatar(lorelei, {
  seed: 'John Doe',
  // ... other options

const svg = avatar.toString();