jspm / registry

The jspm registry and package.json override service
https://jspm.io
230 stars 255 forks source link

moment-timezone #625

Open guybedford opened 9 years ago

guybedford commented 9 years ago

Continuing from https://github.com/jspm/jspm-cli/issues/1193

lookfirst commented 9 years ago

I'm using the following overrides.

      "npm:moment-timezone@0.4.1": {
        "registry": "jspm",
        "dependencies": {
          "moment": "npm:moment@^2.10.6"
        },
        "shim": {
          "moment-timezone": {
            "deps": [
              "moment"
            ]
          }
        }
      },
      "npm:moment@2.10.6": {
        "main": "moment",
        "format": "global",
        "shim": {
          "locale/*": {
            "deps": [
              "../moment"
            ]
          }
        }
      }
lookfirst commented 9 years ago

Also...

      "github:siddii/angular-timer@1.3.3": {
        "main": "dist/angular-timer",
        "registry": "jspm",
        "format": "global",
        "dependencies": {
          "angular": "^1.4.1",
          "moment": "npm:moment@^2.10.6",
          "humanize-duration": "^3.0.0"
        },
        "shim": {
          "dist/angular-timer": {
            "deps": [
              "angular",
              "humanize-duration",
              "moment"
            ]
          }
        }
      },
seangwright commented 9 years ago

@lookfirst I've been trying to get moment-timezone to work for an angular module ( https://github.com/alexcheng1982/angular-timezone-select ) but I can't get the timezone data to load correctly. When I break here https://github.com/alexcheng1982/angular-timezone-select/blob/master/dist/angular-timezone-select.js#L5 .tz is not defined as a property of moment.

The angular module doesn't have any dependencies defined for moment or moment-timezone so I imagine I will either have to add those dependencies directly to my app or modify the file in the angular-timezone-select package directly.

How did you get this working?

lookfirst commented 9 years ago

I did the overrides above and this import:

import moment from 'moment-timezone';

cAhmad commented 9 years ago

@lookfirst I'm using this override :

"npm:moment-timezone@0.4.1": {
  "map": {
    "moment": "moment"
  }
}
naz commented 9 years ago

I'm stuck with the same problem, can't load moment-timezone-with-data as a main source for moment. Tried installing with: jspm install npm:moment-timezone -o '{ main: "builds/moment-timezone-with-data", dependencies: { moment: "^2.10.6" }, shim: { "moment-timezone": { deps: [ "moment" ] } } }' but that didn't help much.

naz commented 9 years ago

I suspect it has something to do with loading moment-timezone multiple times. As the errors are pretty similar - https://github.com/moment/moment-timezone/issues/193

lookfirst commented 9 years ago

Use my overrides above. Works fine.

naz commented 9 years ago

@lookfirst oh man, if you ever come to visit Cracow, ping me, I owe you some good :beer: :smile: I've spent about 2 hours digging around this problem