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

Reduce bundle size #11

Open
davestewart opened this issue Jun 22, 2017 · 0 comments
Open

Reduce bundle size #11

davestewart opened this issue Jun 22, 2017 · 0 comments

Comments

@davestewart
Copy link
Owner

davestewart commented Jun 22, 2017

The minified bundle is 25K, which I think is too big.

It would be nice to reduce this, either at source or by optimising for tree-shaking.

Extract DSL parsing to a separate class

The StateMachine class would then only take Object config. String options could be pre-processed and saved as JSON, then used in size-critical builds:

import { parse } from 'state-machine'
const config = parse(options) // could be saved as json
var fsm = new StateMachine(config)

Another option might be to create this using a plugin system like Vue, i.e.:

StateMachine.use(ParseConfig)

All files needed for parsing config would then be omitted from the final bundle.

Could do some rudimentary tests first to see the impact

Refactor to be simpler

Right now, ValueMap is used to set and get values. Could this be simplified, or target nodes targeted using concatenation rather than parsing, then the class omitted?

var target = transitions[foo][bar]

Should check the code to see how much of an impact this actually is. Could be a tradeoff too far.

Reduce lines of code

Not sure how feasible this is

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