vue-i18n-next: Type declaration file could not be found
Reporting a bug?
There are types at ‘…/node_modules/vue-i18n/dist/vue-i18n.d.ts’, but this result could not be resolved when respecting package.json “exports”. The ‘vue-i18n’ library may need to update its package.json or typings
Expected behavior
import { createI18n } from "vue-i18n";
import type {
I18n,
I18nOptions,
Locale,
VueI18n,
Composer,
I18nMode,
} from "vue-i18n";
When I use the above code, my ts says I can’t find the module declaration file.
It’s fine when I modify an export in a dependent file: /node_modules/vue-i18n/package
"exports": {
".": {
"import": {
"node": "./index.mjs",
"default": "./dist/vue-i18n.esm-bundler.js"
// Here's what I added
"types":"./dist/vue-i18n.d.ts"
},
"require": "./index.js"
},
"./dist/*": "./dist/*",
"./index.mjs": "./index.mjs",
"./package.json": "./package.json"
},
Reproduction
https://github.com/CodeGetters/studtwork_desk/tree/ae78b7538048c538dd2fe05153cba8d340db323a
System Info
System:
OS: Windows 10 10.0.19045
CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz
Memory: 4.04 GB / 15.65 GB
Binaries:
Node: 18.16.0 - D:\nvm_software\nodejs\node.EXE
Yarn: 1.22.19 - D:\nvm_software\nvm\nvm\node_global\yarn.CMD
npm: 9.5.1 - D:\nvm_software\nodejs\npm.CMD
pnpm: 8.6.11 - D:\nvm_software\nvm\nvm\node_global\pnpm.CMD
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (115.0.1901.200)
Internet Explorer: 11.0.19041.1566
npmPackages:
@intlify/vite-plugin-vue-i18n: ^7.0.0 => 7.0.0
@vitejs/plugin-vue: ^4.2.3 => 4.2.3
vite: ^4.4.5 => 4.4.8
vite-plugin-checker: ^0.6.1 => 0.6.1
vite-plugin-compression: ^0.5.1 => 0.5.1
vite-plugin-vue-devtools: ^1.0.0-beta.6 => 1.0.0-beta.6
vite-plugin-vue-markdown: ^0.23.7 => 0.23.7
vite-svg-loader: ^4.0.0 => 4.0.0
vitest: ^0.34.1 => 0.34.1
vue: ^3.3.4 => 3.3.4
vue-i18n: ^9.2.2 => 9.2.2
vue-lazyload: ^3.0.0 => 3.0.0
vue-router: ^4.2.4 => 4.2.4
vue-tsc: ^1.8.5 => 1.8.8
Screenshot
Additional context
No response
Validations
- Read the Contributing Guidelines
- Read the Documentation
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussions
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 9
- Comments: 18 (1 by maintainers)
I upgrade to “9.3.0-beta.25”, then run “pnpm dev” reports as this :
用9.0.0试试吧 我用的这个没问题
我也出现这个报错Failed to resolve entry for package “@intlify/shared”. The package may have incorrect main/module/exports specified in its package.json: No known conditions for “.” specifier in “@intlify/shared” package [plugin vite:dep-pre-bundle] 但是我的项目中没有找到@intlify/shared文件
There wasn’t any change from night to morning in that part. I mean, it’s a package which wasn’t updated or something. The other thing right now is that I downgraded it to 9.1.8 and it runs well on localhost but in docker persist the error. What could be the error on docker?
This is an awkward error. Yesterday everything was working fine and this morning when running the site throwed that error. I tried to uninstall to reinstall, to updgrade and downgrade and that annoying error it’s still there. Really feels like there is no exit.
No this hasn’t been solved. I updated vue-I18n and the error persist. Really don’t know what to do. My site is not running because of this error
I switched the version of vue-i18n to 9.2.2 and used the following ts configuration to successfully package and display
same issue with vue-i18n@9.2.2
Is it normal for you to pack locally? If it is normal, there should be no mistakes in docker.
upgrade “vue-i18n”: “^9.3.0-beta.25”