Skip to content

Commit b3d7400

Browse files
authored
feat(nuxt): move to ESM-first and fix types (#3606)
1 parent 0a9aabd commit b3d7400

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

packages/metadata/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"main": "./index.cjs",
3131
"module": "./index.mjs",
32-
"types": "./index.d.cts",
32+
"types": "./index.d.ts",
3333
"files": [
3434
"index.*"
3535
],

packages/nuxt/index.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// CommonJS proxy to bypass jiti transforms from nuxt 2 and using native ESM
2-
module.exports = function (...args) {
2+
exports.default = function (...args) {
33
return import('./index.mjs').then(m => m.default.call(this, ...args))
44
}
55

packages/nuxt/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "@vueuse/nuxt",
3+
"type": "module",
34
"version": "10.7.2",
45
"description": "VueUse Nuxt Module",
56
"author": "Anthony Fu <https://github.com/antfu>",
@@ -31,7 +32,7 @@
3132
},
3233
"main": "./index.cjs",
3334
"module": "./index.mjs",
34-
"types": "./index.d.cts",
35+
"types": "./index.d.ts",
3536
"peerDependencies": {
3637
"nuxt": "^3.0.0"
3738
},

scripts/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export async function updatePackageJSON(indexes: PackageIndexes) {
248248
directory: `packages/${name}`,
249249
}
250250
packageJSON.main = './index.cjs'
251-
packageJSON.types = './index.d.cts'
251+
packageJSON.types = packageJSON.type === 'module' ? './index.d.ts' : './index.d.cts'
252252
packageJSON.module = './index.mjs'
253253
if (iife !== false) {
254254
packageJSON.unpkg = './index.iife.min.js'

0 commit comments

Comments
 (0)