Next.js: Next.js should ignore all Moment locales via opt-in

Created on 9 Aug 2019  路  4Comments  路  Source: vercel/next.js

Next.js should ignore all moment locales and request the user opt-into the feature, until it becomes a default at some point in the future.

      // Moment.js is an extremely popular library that bundles large locale files
      // by default due to how Webpack interprets its code. This is a practical
      // solution that requires the user to opt into importing specific locales.
      // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
      new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),

Maybe it's worth tuning Lodash with babel-plugin-transform-imports or something similar?

Most helpful comment

That's why the behavior is opt-in @kachkaev!

All 4 comments

This looks like a breaking change 馃

That's why the behavior is opt-in @kachkaev!

I thought the ignore plugin would be just injected and that's it. If it's behind a option, no Next.js projects will be harmed after a minor version bump :)

This was landed in #8345

Was this page helpful?
0 / 5 - 0 ratings