-
Notifications
You must be signed in to change notification settings - Fork 698
wrong package exports #3112
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
What issue do you encounter exactly? The exports to |
@benjamincanac you can already adopt them before the module builder upgrade, if you want |
What are the benefits? 🤔 |
It's more correct. If it's well set up, it means the types users can see in their projects is consistent across node10/node16 module resolutions modes + ESM/CJS. You can see the results here: https://arethetypeswrong.github.io/?p=@nuxt/ui@3.0.0-alpha.11 Nuxt modules don't need to be imported in CJS so that row is less important. Some of the other columns are failing due to imports (like |
@danielroe Do you have any guidelines to make the switch? |
I can send a PR |
Following changes using Nuxt with ESM only and dual CJS/ESM for vite and unplugin (without Node10 types support). You can check for example https://github.com/vite-pwa/nuxt/blob/main/package.json I've also included "imports": {
"#build/ui": "./.nuxt/ui/index.ts",
"#build/ui/*": "./.nuxt/ui/*.ts"
}, We also need to check why we're exporting runtime types from the module, this is breaking Windows build since .vue files cannot be resolved. NOTE: since I cannot build Nuxt UI on my Windows laptop I cannot test it, I just downloaded latest tarball file and patched it manually. Upps, you can ignore this change: "build": "nuxt-module-build build && pnpm devtools:build",
+ "build:module": "nuxt-module-build build", Subject: [PATCH] fix package export
---
Index: package.json
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/package.json b/package.json
--- a/package.json (revision 51e5e65be7f834ec226be28d95a1b547b85b329c)
+++ b/package.json (date 1737720287506)
@@ -12,18 +12,15 @@
"license": "MIT",
"exports": {
".": {
- "types": "./dist/module.d.ts",
+ "types": "./dist/types.d.mts",
"style": "./dist/runtime/index.css",
- "import": "./dist/module.mjs",
- "require": "./dist/module.cjs"
+ "default": "./dist/module.mjs"
},
"./unplugin": {
- "types": "./dist/unplugin.d.ts",
"import": "./dist/unplugin.mjs",
"require": "./dist/unplugin.cjs"
},
"./vite": {
- "types": "./dist/vite.d.ts",
"import": "./dist/vite.mjs",
"require": "./dist/vite.cjs"
},
@@ -43,7 +40,7 @@
"nuxt-ui": "./cli/index.mjs"
},
"style": "./dist/runtime/index.css",
- "main": "./dist/module.cjs",
+ "main": "./dist/module.mjs",
"types": "./dist/types.d.ts",
"files": [
".nuxt/ui",
@@ -53,6 +50,7 @@
],
"scripts": {
"build": "nuxt-module-build build && pnpm devtools:build",
+ "build:module": "nuxt-module-build build",
"prepack": "pnpm build",
"dev": "DEV=true nuxi dev playground",
"dev:vue": "DEV=true vite playground-vue", |
@userquin Do you plan to send a PR? |
yes, but I still cannot build the repo on my local, my pr merged at nuxt-component-meta but not released yet: |
@userquin we got a new release for nuxt-component-meta@0.10.1. If it is ok for you I would like to test it and fix this in #3479 later today or upcoming days |
Closing this as it should have been fixed by #3799. Feel free to reopen if I misunderstood the issue. |
Environment
NA
Is this bug related to Nuxt or Vue?
Nuxt
Version
v3.0.0-alpha
Reproduction
NA: check the package.json file
Description
The package exports using .d.ts instead d.mts.
#imports
should also be reviewed, for example we should add#build/ui
.For reference:
nuxt
andnuxt/app
resolutions nuxt#30148/cc @danielroe
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: