New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Locales difference between version 2.24.0 and 2.27.0 #5623
Comments
What if you load it like this: import 'moment/locale/fr'; |
Nope, it doesn't work on any of these versions. |
Webpack is kind of weird with And some say that locale loading doesn't work up anymore on that issue #5484 Maybe |
Having the same issue with moment-2.27.0 in TypeScript: import moment from 'moment';
import 'moment/locale/de-at';
moment.locale('de-at');
console.log(moment.locale());
console.log(moment.locales()); this prints:
which apparently is wrong and dates are not localized. |
@jrief Well I'm just having a hard time reproducing it. Is your build picking up moment UMD builds or is trying to use the es6 builds? If possible, I would like to see the |
sure, here is my package.json: {
"name": "mcs-connect-webui",
"version": "0.1.0",
"description": "Stencil App Starter",
"scripts": {
"build": "stencil build",
"start": "stencil build --dev --watch --serve",
"test": "stencil test --spec --e2e",
"test.watch": "stencil test --spec --e2e --watchAll",
"generate": "stencil generate",
"watch": "stencil build --dev --watch"
},
"dependencies": {
"@stencil/core": "1.8.4",
"@stencil/router": "^1.0.1",
"bootstrap": "^4.4.1",
"font-awesome": "^4.7.0",
"moment": "2.27.0"
},
"license": "MIT",
"devDependencies": {
"@stencil/sass": "^1.3.1",
"@types/jest": "24.0.25",
"@types/puppeteer": "1.20.3",
"fetch-mock-jest": "^1.3.0",
"http-proxy": "^1.18.0",
"jest": "24.9.0",
"jest-cli": "24.9.0",
"mime-types": "^2.1.27",
"puppeteer": "1.20.0"
}
} I'm actually building through the stenciljs build script, rather than webpack. |
Here's the package.json for moment:
|
@Alin13 Yeah your Right now there seems to be an issue with ES6 module builds and import moment from 'moment' It will map that to However, it seems to be that bundlers aren't mapping other entries from If your code doesn't show any errors then it might just be that you have multiple copies of it. An easy check could be with: If you are indeed using As for |
I am also using it with stencil build. It does not throw any error during stencil build, but the locales are not loaded.
|
I was looking at https://github.com/ionic-team/stencil/blob/master/src/compiler/bundle/bundle-output.ts#L38 That probably means that unless the configuration overrides the If it's really using import moment from 'moment';
import 'moment/dist/locale/de-at';
console.log(moment.localess()) //should print ['en', 'de-at']; |
@MinusFour That worked – great, you saved my day! |
In my case I wanted to load all the locales upfront. Right now I'm importing like |
@AThiyagarajan you might find your issue on StackOverflow. Thanks to @MinusFour who gave a solution. |
Hello,
I'm using moment with react and webpack and I'm having some issues with the locale config. In my app I need to have "en" and "fr" locales.
For this I have this config:
in the root file:
import moment from 'moment';
import 'moment/src/locale/fr';
I also added moment-locales-webpack-plugin in webpack config - because I thought that moment will import all the languages by default (anyway, this shouldn't have an impact on the problem)
The problem
console.log(moment.locales())
Is there something that I do wrong ? Am I missing some configs ?
Thank you for your time!
The text was updated successfully, but these errors were encountered: