Closed jakedetels closed 4 months ago
Thanks for the pull request! I'm still wondering how to best integrate node.js specific things into the library, there are e.g. async_hooks
and the ws
library already. Can you for now rename "server" to "node"?
I spent considerable time trying to find an alternate way to incorporate node.js specific code, including examining the example with getRun.ts and its use of conditional imports with async_hooks. Conditional imports wouldn't work in this case. All the research I found indicated the best strategy is splitting the build into browser vs. node specific files. Glad to try other options if any can be identified.
I spent considerable time trying to find an alternate way to incorporate node.js specific code, including examining the example with getRun.ts and its use of conditional imports with async_hooks. Conditional imports wouldn't work in this case. All the research I found indicated the best strategy is splitting the build into browser vs. node specific files. Glad to try other options if any can be identified.
Makes sense, this is a good starting point and might be the best solution. Is the re-export of ../index
needed?
I was on the fence about the re-export of ../index
. I've removed it.
Awesome, merged. Thank you!
Introduced a new FileCache class to enable file-based caching. Given FileCache is a node.js specific module (and cannot be run in the browser), I expose access to it via:
modelfusion/server re-exports everything from modelfusion/index.ts, and additionally includes any node.js specific tools. Without bundling the code this way, we encounter a build error when attempting to import modelfusion into browser contexts (as in the nextjs example app).