Skip to content

Commit c8b7b23

Browse files
authored
fix: package types (#164)
1 parent 1bfbb9e commit c8b7b23

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

custom-configuration.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import type { ExternalVuetifyOptions } from './dist/module'
1+
import type { ExternalVuetifyOptions } from './dist/module.js'
22
declare function defineVuetifyConfiguration(vuetifyOptions: ExternalVuetifyOptions): ExternalVuetifyOptions;
33
export { defineVuetifyConfiguration };

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"./*": "./*"
3535
},
36-
"main": "./dist/module.cjs",
36+
"main": "./dist/module.mjs",
3737
"types": "./dist/types.d.ts",
3838
"files": [
3939
"dist",
@@ -42,7 +42,7 @@
4242
"*.mjs"
4343
],
4444
"scripts": {
45-
"prepack": "nuxt-module-build prepare && nuxt-module-build build",
45+
"prepack": "nuxt-module-build prepare && nuxt-module-build build && jiti scripts/postbuild.ts",
4646
"dev": "nuxi dev playground",
4747
"dev:multiple-json": "MULTIPLE_LANG_FILES=true nuxi dev playground",
4848
"dev:prepare": "nuxt-module-build --stub && nuxt-module-build prepare && nuxi prepare playground",

scripts/postbuild.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { readFileSync, writeFileSync } from 'node:fs'
2+
import { resolve } from 'node:path'
3+
4+
// fix d.mts imports
5+
const mDtsModule = resolve('dist/types.d.mts')
6+
const mDtsModuleContent = readFileSync(mDtsModule, 'utf-8')
7+
writeFileSync(
8+
mDtsModule,
9+
mDtsModuleContent.replaceAll(
10+
'from \'./module\'',
11+
'from \'./module.js\'',
12+
),
13+
'utf-8',
14+
)

0 commit comments

Comments
 (0)