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

Enigma.js in not tree-shaking friendly #621

Open
VincentDauliac opened this issue Jul 20, 2019 · 1 comment
Open

Enigma.js in not tree-shaking friendly #621

VincentDauliac opened this issue Jul 20, 2019 · 1 comment

Comments

@VincentDauliac
Copy link

The size of the library in an app bundle could be improved by making it tree-shakable and more modular. The main issue are the JSON schemas because even if we only use a single method of the Engine API, all methods definitions are loaded in the app bundle.
I know it is possible to manually strip down a schema definition file to only keep the necessary, but being able to import only the needed methods would be simpler and safer.

For an enterprise BI app or a Node.js program bundle size may not be such a big concern, but for a public facing app it clearly is a downside.

I don't know if a change in that direction is possible, or if there are existing solutions/tricks addressing this concern. Let me know !

Thanks

@peol
Copy link
Contributor

peol commented Aug 22, 2019

Hi Vincent, sorry for the late response. Your issue got lost in all the post-vacation emails.

Thanks for the issue, you're highlighting something we've been talking about for quite some time. It does however require some significant changes to the library so we would have to plan in this work sometime in the future.

What you're mentioning about manually reducing the schema is the best supported way today. An unsupported way would be to manually pass in the JSONRPC request but YMMV here:

session.send({
  handle: model.handle || someNumericHandle,
  method: "GetLayout",
  params: [],
});

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

No branches or pull requests

2 participants