Closed angelosarto closed 8 years ago
moment and moment-timezone and npm deps in this case, not bower deps.
https://github.com/jasonmit/ember-cli-moment-shim/blob/master/package.json#L31-L32
Reopening since that still doesn't solve your question, but answers your bowser concern.
Can you try and reproduce it in isolate and push that project to github so I can inspect. I cannot reproduce this locally. Historically, this issue has popped up when another addon, or your own applications Brocfile
|| ember-cli-build.js
app.imports
moment.
It looks like ember-pikaday advises you to add moment to your Brocfile, which is ill-advised if you're already using ember-moment/ember-cli-moment-shim.
This paragraph needs to be reworded: https://github.com/edgycircle/ember-pikaday#localization
Feel free to reopen if you can reproduce it in isolation, but I believe the problem lies in your ember-cli-build or one of the addons you're consuming which app.imports momentjs.
ember g ember-cli-moment-shim
did seem to the do the trick! Thanks
It sounds like you are on an older version of the shim. I suspect it is pikaday. Can you run npm ls ember-cli-moment-shim and less me what that outputs.
I am not sure which I had in first, but I didn't add the pikaday change to ember-cli-build.js:
user-app@ /Users/angelosarto/Work/user-app `-- ember-cli-moment-shim@1.1.0
I am getting a warning [ember-moment] attempted to set timezone, but moment-timezone is not setup. (moment.js:26)
followed by this error:
Unhandled promise rejection TypeError: "_moment.default.tz is undefined" polyfill.js:3941
_callee$ http://localhost:1234/assets/awesum-app.js:54320:21
n https://apps.mypurecloud.com/webchat/jsapi-v1.js:3:488
h https://apps.mypurecloud.com/webchat/jsapi-v1.js:3:1557
r https://apps.mypurecloud.com/webchat/jsapi-v1.js:3:664
step http://localhost:1234/assets/awesum-app.js:54076:24
_asyncToGenerator http://localhost:1234/assets/awesum-app.js:54094:16
Promise http://localhost:1234/assets/vendor.js:10834:7
_asyncToGenerator http://localhost:1234/assets/awesum-app.js:54073:14
submit http://localhost:1234/assets/awesum-app.js:54377:18
send http://localhost:1234/assets/vendor.js:66986:28
superWrapper http://localhost:1234/assets/vendor.js:66703:17
didInsertElement http://localhost:1234/assets/awesum-app.js:54216:9
fn http://localhost:1234/assets/vendor.js:26613:11
invokeWithOnError http://localhost:1234/assets/vendor.js:26044:9
flush http://localhost:1234/assets/vendor.js:26103:9
flush http://localhost:1234/assets/vendor.js:26227:9
end http://localhost:1234/assets/vendor.js:26297:7
run http://localhost:1234/assets/vendor.js:26411:11
_runExpiredTimers http://localhost:1234/assets/vendor.js:26805:5
_boundRunExpiredTimers http://localhost:1234/assets/vendor.js:26266:5
onUnhandled/</abrupt< polyfill.js:3941
perform polyfill.js:3883
onUnhandled/< polyfill.js:3935
[44]</module.exports polyfill.js:872
<anonymous> polyfill.js:1833
run polyfill.js:1821
listener polyfill.js:1825
I tried ember g ember-moment
(which updated "ember-cli-moment-shim"
to "^3.7.1"
)
followed by restarting the server, this error still occurs (also update the line numbers to reflect this newer version)
Moment config in environment.js:
ENV.moment = {
// See https://github.com/stefanpenner/ember-moment#i18n-support
// Full list of locales: https://github.com/moment/moment/tree/2.10.3/locale
includeLocales: 'de en es fr it ja pt ru zh-cn'.split(' '),
// See https://github.com/stefanpenner/ember-moment#include-moment-timezone
includeTimezone: 'all',
allowEmpty: true // default: false
};
DEBUG: -------------------------------
DEBUG: Ember : 2.13.4
DEBUG: Ember Data : 2.18.0
DEBUG: Firebase : 3.9.0
DEBUG: EmberFire : 0.0.0
DEBUG: jQuery : 3.2.1
DEBUG: Ember Simple Auth : 1.2.1
DEBUG: -------------------------------
The error above is caused by just installing ember-auto-import ^1.2.13 with moment ^2.17.1, ember-cli-moment-shim ^3.5.0, and ember-moment ^7.3.0.
Linking to some discussions about this... Looks like this is the first discussion where the issue first appeared, opened by @urbany "Import conflict when using in a project along-side ember-auto-import" https://github.com/cibernox/ember-power-calendar/issues/164 "How to not bundle all moment locales" https://github.com/ef4/ember-auto-import/issues/114#issuecomment-415701712_ Discussion+code about how to solve this long term also by @urbany "WIP: Use ember-auto-import" https://github.com/jasonmit/ember-cli-moment-shim/pull/168
It seems doing either or both of these 2 things solves my issue: npm install moment-timezone --save-dev
add this to your ember-cli-build.js
config:
autoImport: {
exclude: ['moment-timezone', 'moment', 'ember-moment', 'ember-cli-moment-shim']
}
@devinrhode2 if I understood correctly, all we have now is to wait until moment-for-ember authors come up with some decision regarding this problem? Thanks for the clarification in your post btw!
I am not really sure tbh. Not working with ember or the same team anymore.
We'll end up swapping ember-cli-moment-shim over to internally use ember-auto-import while also deprecating the addon.
For those who are conscious of bundle size, and only want certain locales/timezone builds, we'll add documentation.
PRs obviously welcome to move it along.
I am seeing this message when I try to set the timezone. [ember-moment] attempted to set timezone, but moment-timezone unavailable.
I installed using ember install ember-moment and I added to the config/environment.js: In package.json I do see ember-moment and the shim but I don't see timezone.
However if I look in bower.json I don't see moment listed at all.
Did I somehow mess up the install? The helpers work as long as I don't try to set the timezone.
environment.js
moment: { // Options: // 'all' - all years, all timezones // '2010-2020' - 2010-2020, all timezones // 'none' - no data, just timezone API includeTimezone: 'all', includeLocales: true }
bower.json
{ "name": "user-app", "dependencies": { "ember": "2.3.0", "ember-cli-shims": "ember-cli/ember-cli-shims#0.1.0", "ember-cli-test-loader": "ember-cli-test-loader#0.1.3", "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.5", "ember-qunit": "0.4.9", "ember-qunit-notifications": "0.0.7", "ember-resolver": "~0.1.18", "jquery": ">= 1.7.0 < 2.2.0", "loader.js": "ember-cli/loader.js#3.2.1", "qunit": "~1.18.0", "spin.js": "~2.3.2", "foundation-sites": "~6.1.1", "foundation-icon-fonts": "*", "zxcvbn": "~4.0.1", "pretender": "~0.12.0", "lodash": "~3.7.0", "Faker": "~3.0.0", "tether": "^1.0.3", "file-saver.js": "~1.20150507.2", "auth0-lock": "^7.10.2", "jsrsasign": "^5.0.1", "pikaday": "~1.4.0" }, "resolutions": { "ember": "v2.3.0" } }
package.json
"devDependencies": { "auth0-ember-simple-auth": "git://github.com/auth0/auth0-ember-simple-auth.git#ffc5ebf9de6b813cb36f958e6e80d1494bf2f627", "broccoli-asset-rev": "^2.1.2", "broccoli-funnel": "^1.0.1", "broccoli-unwatched-tree": "^0.1.1", "ember-ajax": "0.7.1", "ember-cli": "1.13.8", "ember-cli-babel": "^5.1.3", "ember-cli-content-security-policy": "0.5.0", "ember-cli-cookie": "^0.2.0", "ember-cli-dependency-checker": "^1.0.1", "ember-cli-deploy": "0.5.0", "ember-cli-deploy-lightning-pack": "0.2.0", "ember-cli-dotenv": "1.0.4", "ember-cli-focus-input": "^1.0.0", "ember-cli-htmlbars": "0.7.9", "ember-cli-htmlbars-inline-precompile": "^0.2.0", "ember-cli-ic-ajax": "0.2.1", "ember-cli-inject-live-reload": "^1.3.1", "ember-cli-mirage": "^0.2.0-beta.8", "ember-cli-moment-shim": "1.1.0", "ember-cli-password-strength": "0.1.1", "ember-cli-qunit": "^1.0.0", "ember-cli-release": "0.2.3", "ember-cli-sass": "5.2.1", "ember-cli-sri": "^1.0.3", "ember-cli-uglify": "^1.2.0", "ember-data": "^2.3.0", "ember-disable-proxy-controllers": "^1.0.0", "ember-export-application-global": "^1.0.3", "ember-link-action": "0.0.34", "ember-modal-dialog": "0.8.3", "ember-moment": "6.1.0", "ember-pikaday": "1.1.0", "ember-power-select": "0.10.1", "ember-simple-auth": "1.1.0-beta.3", "ember-spin-spinner": "0.2.4", "ember-tether": "0.2.1", "ember-validations": "~2.0.0-alpha.4", "emberx-select": "2.0.2", "sync-exec": "^0.6.2" },