-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Warning 'The following packages did not export their package.json
file...' in case of non-svelte packages
#244
Comments
This sounds similar to sveltejs/kit#3053. This should be fixed in Vite 2.7.10. Can you confirm this is still happening in the latest version of Kit, Vite and vite-plugin-svelte? If so, it would be great if you can provide a repro |
I'm not using SvelteKit, because my app will be hosted on an embedded server (not nodejs). I have uploaded a small example causing the warning |
I'm not seeing the warning in the repro. When I run
And for
(macos m1, node 16.13.0)
Yes. |
Thank you for the feedback! |
Interesting. I checked node 17.3.0, but I had the same warnings. Dev is still running fine though:
So maybe the node version isn't the issue here 🤔 |
I have no clue why you don't see this warning in your set up, maybe its because you are using a Mac while I'm using Windows. But I found something about this issue in rollup-plugin-svelte, discussed in May 2020. The problem has somethng to do with the (external) module require-relative, used by src/utils/resolve.ts. require-relative will return In my opinion this warning does not make sense in case of external modules not using Svelte, because the idea was to inform the user on potential problems with Svelte. Would there be a simple way to check if a module should use Svelte? Then the check in src/utils/resolve.ts could be skipped. |
Yes you're correct. This only happens for dependencies that you directly import though, so I was confused why the error reported for a transitive library (tslib). Perhaps our custom prebundling handling surface it.
The only best way to check if a module uses Svelte is (ironically) to check the I don't think we should hide this warning altogether, so I was wondering when/how to reproduce it as it's not expected behaviour per my first paragraph. Another hunch I have is that this is caused by vitejs/vite#3951 released in Vite 2.7.0-beta.7 perhaps you can try a version before that and see if the warning still arises? It would be tricky for me to fix this without able to reproduce locally though, so I'm trying to toss some ideas 😅 |
Really wonder whats going on here because tslib should not be checked at all
|
I'm getting the same warning with Vite v2.7.0-beta.6:
|
When I remove the use of |
I'm not really sure how we can resolve this issue. I can't repro it to fix it, so this might have to be stagnant at the meantime. When #222 is resolved, it would also indirectly fix this though |
Still receiving such warning when I import native nodejs packages in endpoints.
"@sveltejs/kit": "^1.0.0-next.257" |
@vfilatov That is now fixed in 1.0.0-next.37 |
Describe the problem
I'm always getting a warning message from
vite:resolve
when tslib is resolved:[vite-plugin-svelte] The following packages did not export their package.json file so we could not check the "svelte" field. If you had difficulties importing svelte components from a package, then please contact the author and ask them to export the package.json file.
- tslib
(see index.ts:205)
The message is caused when somewhere in
src/utils/resolve.ts:resolveViaPackageJsonSvelte(..)
the errorERR_PACKAGE_PATH_NOT_EXPORTED
occurs.Because
tslib
Is a third-party lib that does not use Svelte, it does not make sense to check the "svelte" field.Describe the proposed solution
It would be nice to have an option to exclude some libs from being checked for the "svelte" field.
Alternatives considered
None
Importance
nice to have
The text was updated successfully, but these errors were encountered: