Skip to content

Commit

Permalink
feat(nuxt): move to ESM-first and fix types (#3606)
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin committed Feb 20, 2024
1 parent 0a9aabd commit b3d7400
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/metadata/package.json
Expand Up @@ -29,7 +29,7 @@
},
"main": "./index.cjs",
"module": "./index.mjs",
"types": "./index.d.cts",
"types": "./index.d.ts",
"files": [
"index.*"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/index.cjs
@@ -1,5 +1,5 @@
// CommonJS proxy to bypass jiti transforms from nuxt 2 and using native ESM
module.exports = function (...args) {
exports.default = function (...args) {
return import('./index.mjs').then(m => m.default.call(this, ...args))
}

Expand Down
3 changes: 2 additions & 1 deletion packages/nuxt/package.json
@@ -1,5 +1,6 @@
{
"name": "@vueuse/nuxt",
"type": "module",
"version": "10.7.2",
"description": "VueUse Nuxt Module",
"author": "Anthony Fu <https://github.com/antfu>",
Expand Down Expand Up @@ -31,7 +32,7 @@
},
"main": "./index.cjs",
"module": "./index.mjs",
"types": "./index.d.cts",
"types": "./index.d.ts",
"peerDependencies": {
"nuxt": "^3.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils.ts
Expand Up @@ -248,7 +248,7 @@ export async function updatePackageJSON(indexes: PackageIndexes) {
directory: `packages/${name}`,
}
packageJSON.main = './index.cjs'
packageJSON.types = './index.d.cts'
packageJSON.types = packageJSON.type === 'module' ? './index.d.ts' : './index.d.cts'
packageJSON.module = './index.mjs'
if (iife !== false) {
packageJSON.unpkg = './index.iife.min.js'
Expand Down

0 comments on commit b3d7400

Please sign in to comment.