从 angular 应用中的 chartjs 中删除时刻

Remove moment from chartjs in angular app

我在构建中使用ng2-charts in my project, it is basically just a wrapper over chart.js so I have to install chart.js as well. According to the chart.js docs, moment is included by default,必须通过配置webpack排除。有没有办法在 angular 应用程序中配置构建?或者其他一些排除时刻的方法?注意,我没有直接使用 chart.js,它被 ng2-charts 库使用。

在使用 Chart.js V3 的 ng2-charts 库的即将发布的版本 (V3) 中,默认情况下它不再存在。

根据 chart.js 本身的 documentation 你可以像这样删除时刻:

// Webpack
{
    externals: {
        moment: 'moment'
    }
}

// Rollup
{
    external: ['moment']
}