Skip to content

Consider using error code strategy employed by react #3655

Closed
@heygrady

Description

@heygrady

https://github.com/facebook/react/tree/master/scripts/error-codes

Right now, every production website that uses redux is shipping lengthy error messages that are better suited to development.

Example:

'Reducer "'+t+"" returned undefined when probed with a random type. Don't try to handle "+n.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.'

My rough guestimate is that you could reduce the minified version of redux from 6660 characters to more like 4200 characters by replacing these long messages with terse, generated error codes like throw code(1). Seems worth it for potential savings of more than 35%.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions