Skip to content
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

Support Angular (or custom worker URLs) #468

Open
childersd opened this issue Aug 25, 2024 · 2 comments
Open

Support Angular (or custom worker URLs) #468

childersd opened this issue Aug 25, 2024 · 2 comments

Comments

@childersd
Copy link

childersd commented Aug 25, 2024

The Angular build system does not seem to correctly pick up worker URLs:

Security Error: Content at http://localhost:4200/ may not load data from file:///.../node_modules/@evolu/common-web/dist/Db.worker.js.

This happens for both the old ("browser") and new ("esbuild"/"application") Angular build systems, regardless of a dev or production build. I suspect this might be because workers are defined inside a factory function. Additionally, if I'm reading your code right, the DB factory relies on the DB worker, which in turn defines the Sync worker. However,

any nested workers will not be processed by the build system. A nested worker is a Worker instantiation within another Worker file.

This only applies to the new build system, but I'm noting it already since it might cause issues later.

A suggestion: instead of supporting a specific framework like Angular, you could allow custom worker URLs to be passed to Evolu. This would allow users to self-host workers separate from their build system. I've seen this pattern before in open-source projects (e.g., a workerSrc property in pdf.js).

Since createEvolu comes from a factory function, I tried to do this myself, but the common-web package doesn't export the required tooling for this (e.g., wrap), and my project won't compile as a result.

I hope we can fix this–I'd love to start with Evolu.

@steida
Copy link
Contributor

steida commented Aug 25, 2024

I'm happy to help with advice, or I can export missing functionality, but any direct work for supporting Angular has a low priority for me. I highly recommend using any other library; Angular was abandoned even by its authors.

@negue
Copy link
Contributor

negue commented Oct 3, 2024

There is AngularJS, that was abandoned ^^

Angular (rewritten in TypeScript) is very much alive, latest release yesterday https://github.com/angular/angular/releases/tag/18.2.7

As for the this Issue, I haven't tried it for angular yet, currently more focused on svelte but sooner or later I'll definitely try Angular (with Evolu) again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants