You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.
Using Capi with a web bundler requires extra configuration to shim/polyfill the Capi dnt npm module.
One reason is that dnt targets node.
Another reason is that capi have the capicli (serve/sync) in the same npm module.
Perhaps, there could be 2 npm packages capi and capi-cli (as suggested by @peetzweg).
For example, for capi@0.1.0-beta40 and vite this config is used
Note: for a vite prod build, the process global var needs to be shimmed differently because vite define define entries as globals during dev but it statically replace them during build.
I would say that dnt transpiles TS and rewrites imports.
That seems to be fine.
I think that the issue is that the main Capi entry point is transitive depedent on a some node requires.
As far as I know, those node requires are used in the Capi CLI (sync/serve).
So the solution could be to identify that shared dependency and make sure that it doesn't land in the main Capi entry point dependencies.
So far, based on the vite build output, it seems that the dependencies are
node:http > Missing export "createServer" has been shimmed in module "__vite-browser-external".
node:net > Missing export "createConnection" has been shimmed in module "__vite-browser-external".
node:fs/promises > Missing export "open" has been shimmed in module "__vite-browser-external".
node:stream > Missing export "Writable" has been shimmed in module "__vite-browser-external".
Using Capi with a web bundler requires extra configuration to shim/polyfill the Capi dnt npm module.
One reason is that dnt targets
node
.Another reason is that
capi
have thecapi
cli
(serve
/sync
) in the same npm module.Perhaps, there could be 2 npm packages
capi
andcapi-cli
(as suggested by @peetzweg).For example, for
capi@0.1.0-beta40
andvite
this config is usedNote: for a vite prod build, the
process
global var needs to be shimmed differently because vite define define entries as globals during dev but it statically replace them during build.Something similar is required for
webpack
The text was updated successfully, but these errors were encountered: