-
Notifications
You must be signed in to change notification settings - Fork 2.4k
[Live preview] Cannot import package on SvelteKit adapter node #4555
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
Comments
Same here. Also with the updated Version 0.2.2.
|
What I did for the time till this is fixed is I copied the files from the src directory to my project (as they don't have any dependencies). This works for me now |
@RickGeersing this sounds to me like an issue in the module resolution of your compiler, and I suspect there's a solution listed somewhere in this thread: sveltejs/kit#928 For some context: in 2.0, all of Payload's packages are compiled to CommonJS. As @madaxen86 suggests, you'd need to adjust your compiler's settings based on the environment that it's targeting. Alternatively, you might be able to handle your imports differently. CommonJS is a known pain point across the ecosystem, which is why in 3.0, we've switched fully to ESM. If using 3.0 is an option, this alone might fix your issue. Because this is not an issue on Payload's end, I'm going to close this ticket. Feel free to continue the conversation as needed, though, especially with helpful solutions for others to find. |
This issue has been automatically locked. |
Link to reproduction
No response
Describe the Bug
I want to use the
live-preview
package in combination with SvelteKit. Works very nicely on development workflows. But whenever I build my SvelteKit app with theadapter-node
and run it I get the following error.I've already tried to load it in as a default import ex.
import livePreview from '@payloadcms/live-preview'
, that works on the build version but not on development.Packages:
"@sveltejs/kit": 1.27.6
"@sveltejs/adapter-node": 1.3.1
"vite": 4.5.0
"@payloadcms/live-preview": 0.2.1
"node": 18.19.0
To Reproduce
@payloadcms/live-preview
dependency.yarn build
yarn start
http://localhost:3000
Payload Version
2.4.0
Adapters and Plugins
No response
The text was updated successfully, but these errors were encountered: