diff --git a/package.json b/package.json index 9156242..1444475 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,11 @@ "files": [ "dist" ], - "main": "./dist/index.js", - "module": "./dist/index.js", - "types": "./dist/index.d.ts", + "main": "./dist/index.mjs", + "module": "./dist/index.mjs", + "types": "./dist/index.d.mts", "exports": { - ".": "./dist/index.js", + ".": "./dist/index.mjs", "./package.json": "./package.json" }, "publishConfig": { @@ -67,5 +67,9 @@ "engines": { "node": ">=20.19.0" }, - "prettier": "@sxzz/prettier-config" + "prettier": "@sxzz/prettier-config", + "tsdown": { + "exports": true, + "inlineOnly": [] + } } diff --git a/src/index.ts b/src/index.ts index 621d253..25ebf95 100644 --- a/src/index.ts +++ b/src/index.ts @@ -40,8 +40,10 @@ export function RequireCJS(userOptions: Options = {}): Plugin { }, outputOptions(options) { if (!['es', 'esm', 'module'].includes(options.format as any)) { - throw new Error( - '`rolldown-plugin-require-cjs` plugin is only necessary for ESM output', + this.error( + new Error( + '`rolldown-plugin-require-cjs` plugin is only necessary for ESM output', + ), ) } },