webpacktimezonemomentjsrollupjs

using rollupjs with moment-timezone


I have a package that depends on moment-timezone. The package is used in a website bundled with webpack 2.

We now bundle it with rollupjs, which is great because it seems better than compile it to ES5.

The problem that we have now is to manage timezone. How can I get the moment instance and inject a specific timezone.

Previously, the moment instance was global, so we could change the locale from the website. Now it seems that the moment instance is local.

How can I "share" the moment instance between the package and the website?

Thanks


Solution

  • Fixed my issue by using dependency injection.

    I injected the moment instance in my package, and use the same instance though.