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

Suggestions for Workers and Models #2

Open
ZeroThe2nd opened this issue Jan 4, 2019 · 0 comments
Open

Suggestions for Workers and Models #2

ZeroThe2nd opened this issue Jan 4, 2019 · 0 comments

Comments

@ZeroThe2nd
Copy link

When using ant with systems like VueJS in a component structure, it's hard to use fixed paths to models and workers. The workers have to be copied, then imported, and models are always loaded by file path.

ANT plays nice with module a node module system, however still relies on these paths. This causes issues when used with a compiler like Webpack or such. The way these are imported, it's also simply not possible to use something like worker-loader to compile an application into a production ready, minimised file, hence there's always a need to add the 4 separate files into the project as uncompiled code. This also makes updating the package harder in the future as the files need to be copied on every build to ensure it's the latest version.

Suggestion: Use Freelancer, Blobs or this SO post to create service workers without needing a file path.

Suggestion: Allow models to be imported by Object reference:

import UserModel from 'Models/User'
ANT.init({
  models: { // Instead of modelsPaths to keep it compatible
    User: UserModel
  }
})

I currently haven't had the time to dig through all the code, but I'd love to try and improve on it. I'll make a PR if I've made some progress. Are you able to provide a test script of sorts I can use as a verification that everything still works as required?

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

1 participant