brockpetrie / vue-moment

Handy Moment.js filters for your Vue.js project.
MIT License
1.31k stars 121 forks source link

Reduce bundle size? #142

Open sneko opened 4 years ago

sneko commented 4 years ago

Hi @brockpetrie,

There are several ways to not include all locales in the final build bundle with moment.js as described here: https://github.com/jmblog/how-to-optimize-momentjs-with-webpack (Note that tree-shaking is still not planned for moment.js 😢 )

But I don't know how to manage that since vue-moment is the intermediary.

Any idea?

Thank you,

EDIT: I tried using https://github.com/moment/moment/issues/2517#issuecomment-620674018 but the size has not changed at all. A bit weird ^^... maybe because of the VueMoment intermediary?

lyokha113 commented 4 years ago

You could do the same in vue.config.js E.g for IgnorePlugin

const webpack = require("webpack");
module.exports = {
  publicPath: "/",
  configureWebpack: {
    plugins: [new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)]
  }
};