diff --git a/custom-configuration.d.ts b/custom-configuration.d.ts index 43bdfe0..f9dce1e 100644 --- a/custom-configuration.d.ts +++ b/custom-configuration.d.ts @@ -1,3 +1,3 @@ -import type { ExternalVuetifyOptions } from './dist/module' +import type { ExternalVuetifyOptions } from './dist/module.js' declare function defineVuetifyConfiguration(vuetifyOptions: ExternalVuetifyOptions): ExternalVuetifyOptions; export { defineVuetifyConfiguration }; diff --git a/package.json b/package.json index aae3504..2bf8ec2 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ }, "./*": "./*" }, - "main": "./dist/module.cjs", + "main": "./dist/module.mjs", "types": "./dist/types.d.ts", "files": [ "dist", @@ -42,7 +42,7 @@ "*.mjs" ], "scripts": { - "prepack": "nuxt-module-build prepare && nuxt-module-build build", + "prepack": "nuxt-module-build prepare && nuxt-module-build build && jiti scripts/postbuild.ts", "dev": "nuxi dev playground", "dev:multiple-json": "MULTIPLE_LANG_FILES=true nuxi dev playground", "dev:prepare": "nuxt-module-build --stub && nuxt-module-build prepare && nuxi prepare playground", diff --git a/scripts/postbuild.ts b/scripts/postbuild.ts new file mode 100644 index 0000000..12075c2 --- /dev/null +++ b/scripts/postbuild.ts @@ -0,0 +1,14 @@ +import { readFileSync, writeFileSync } from 'node:fs' +import { resolve } from 'node:path' + +// fix d.mts imports +const mDtsModule = resolve('dist/types.d.mts') +const mDtsModuleContent = readFileSync(mDtsModule, 'utf-8') +writeFileSync( + mDtsModule, + mDtsModuleContent.replaceAll( + 'from \'./module\'', + 'from \'./module.js\'', + ), + 'utf-8', +)