Skip to content

d3-format@1.4.2 sideEffects:false breaks graph axis formatting #84

@dpmott

Description

@dpmott

d3-format@1.4.2 sideEffects:false breaks graph axis formatting

The d3-format src\defaultLocale.js calls defaultLocale at load time. This is, by definition, a side effect of loading the module. As such, it's inappropriate to set sideEffects:false in the package.json file. I believe that this is the root cause of this issue.

For our project compiled for production, d3-format@1.4.2 causes d3-scale\src\tickFormat.js to exception when it calls format(), because format has not been defined, presumably because webpack's tree shaking has entirely removed d3-format's invocation of defaultLocale().

The docs at https://www.npmjs.com/package/d3-format say this:

If you do not set a default locale, it defaults to U.S. English.

However, this is not true when compiling in production mode with d3-format@1.4.2.

When I explicitly install d3-format@1.4.1, or if I explicitly call d3d3.formatDefaultLocale(), then I do not get an exception, and my graphs render in my application.

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