Closed skota-in closed 1 year ago
hello, unfortunately sweph does not support running on browsers, it is a NodeJS-only library.
It works on the NestJS side because its a backend framework that is executed on the server side, in a NodeJS server, but Angular is a frontend framework and its application is bundled and sent to run on the browser, where it cannot run.
The solution is to have sweph only on the server side, and create an api to interact with it from the Angular side through fetch requests or similar methods.
Thanks for the reply. You covered that in Limitations
But looking at the error, i felt like tweaking tsconfig will help Angular to load the module.
Will give a try with emscripten & WebAssembly
I'm building an Angular application but unable to integrate sweph library.
Error:
./node_modules/sweph/index.mjs:1:0-39 - Error: Module not found: Error: Can't resolve 'module' in 'C:\Users\admin\Workspace\github\sweph\sweph-ui\node_modules\sweph'
Here is the Git repo
It has 2 projects. (both are NodeJS frameworks)
sweph-ui = Angular application sweph-api = NestJS application
NestJS, its working fine.
So want to know if there is a workaround for sweph + angular.