diff --git a/package.json b/package.json index 08a4907d..ce89630b 100644 --- a/package.json +++ b/package.json @@ -49,4 +49,4 @@ "rxjs": "^7.1.0" }, "packageManager": "yarn@3.2.3" -} \ No newline at end of file +} diff --git a/packages/@contentlayer/core/src/generation/generate-dotpkg.ts b/packages/@contentlayer/core/src/generation/generate-dotpkg.ts index 847f8790..4cd9023c 100644 --- a/packages/@contentlayer/core/src/generation/generate-dotpkg.ts +++ b/packages/@contentlayer/core/src/generation/generate-dotpkg.ts @@ -6,6 +6,7 @@ import type { GetContentlayerVersionError } from '@contentlayer2/utils/node' import { getContentlayerVersion } from '@contentlayer2/utils/node' import { camelCase } from 'camel-case' import type { PackageJson } from 'type-fest' +import * as URL from 'url' import { ArtifactsDir } from '../ArtifactsDir.js' import type { HasCwd } from '../cwd.js' @@ -131,7 +132,7 @@ const successCallback = (onSuccess: SuccessCallback | undefined) => { T.tapSync((path) => console.log('successCallback', path)), T.chain((generatedPkgPath) => T.tryCatchPromise( - () => onSuccess(() => import(filePathJoin(generatedPkgPath, 'generated', 'index.mjs'))), + () => onSuccess(() => import(URL.pathToFileURL(filePathJoin(generatedPkgPath, 'generated', 'index.mjs')).href)), (error) => new SuccessCallbackError({ error }), ), ),