Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nuxt): move to ESM-first and fix types #3606

Merged
merged 4 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/metadata/package.json
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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