Open rick516 opened 3 days ago
I have already found out why this error happens and created PR for this issue. Please check https://github.com/DevCycleHQ/js-sdks/pull/992
Hi @rick516 thanks for submitting the PR, our team is taking a look right now.
Hi, @cdruxerman I am always grateful for your DevCycle. It's indispensable for our trunk-based development.
Hey @rick516 , are you using the client-side bootstrapping and SSR features of the SDK?
If so, we deliberately make the JS SDK an "optional" package you have to install to use these features in order to avoid including redundant dependencies for non-SSR usecases.
If you aren't using those features and still getting this error, then it's probably an issue with how Vite is trying to bundle the SDK in your serverside bundle. The JS SDK is "optional" because it is imported using a dynamic import which is only executed when the bootstrapping functionality is used, which works as expected in a normal Node environment. The problem here is that I believe Vite is trying to bundle the SDK, and in doing so it's trying to resolve that dynamic import at build time regardless of whether it's ever called. A simple way to get around this would be to mark our SDK as an 'external' package so that Vite does not attempt to bundle it. I'm also looking at ways we might be able to tell Vite to not resolve this import statement during bundling.
Issue Description:
I am encountering a build error in my Remix application after installing the following dependencies:
Upon running the application, the following error is thrown:
Hypothesis:
It appears that within
@devcycle/nodejs-server-sdk
, there is a dependency on@devcycle/js-client-sdk
that is not being resolved correctly, leading to the build failure.Specifically, in
node_modules/@devcycle/nodejs-server-sdk/src/clientUser.js
, the following line is present:This suggests that
@devcycle/js-client-sdk
is a required dependency but is not listed in thepackage.json
of@devcycle/nodejs-server-sdk
.Request:
Could you please investigate this issue and provide guidance on how to resolve the dependency on
@devcycle/js-client-sdk
when using@devcycle/nodejs-server-sdk
in a Remix application?Thank you for your assistance.