async function createExportsFallbacks() {
  for (const entry of EXPORTS) {
    const fallbackPath = path.join(root, entry)
    await mkdir(fallbackPath, { recursive: true })

    const destinationMain = path.join(root, 'lib.cjs', `${entry}.js`)
    const destinationTypes = path.join(root, 'lib.cjs', `${entry}.d.ts`)

    const packageJson = {
      '//': 'Generated by scripts/setup-exports.js',
      main: relative(fallbackPath, destinationMain),
      types: relative(fallbackPath, destinationTypes),
    }

    const packageJsonPath = path.join(fallbackPath, 'package.json')
    await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2))
  }
}
createExportsFallbacks setups fallbacks for loaders and bundlers not supporting the exports field.
It creates subdirectories with a package.json pointing to the CommonJS file and its type definition,
as explained in https://github.com/andrewbranch/example-subpath-exports-ts-compat/tree/main/examples/node_modules/package-json-redirects.
Therefore, bundlers without `exports` support get at least the CommonJS file and types.