Skip to content
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 in moment/dist/locale are still included #33

Closed
akonyer opened this issue May 21, 2020 · 7 comments
Closed

locales in moment/dist/locale are still included #33

akonyer opened this issue May 21, 2020 · 7 comments

Comments

@akonyer
Copy link

akonyer commented May 21, 2020

Hey, I'm sure I'm doing something wrong here, but even using this plugin with webpack and moment I am still getting the locales directory in my output.

When I look in the node_modules/moment directory, I see two locale folders.

One in the root, and one in dist/locale

I'm not sure why there are two, but no matter what I do the locales in node_moduels/moment/dist/locale are always included.

This seems to only ignore the root node_modules/moment/locale folder.

Any ideas? I'm at a bit of a loss. Thank you very much

@iamakulov
Copy link
Owner

Thanks for the heads-up! Looks like Moment 2.25.2+ started publishing locale files under dist as well. Coming up with the fix.

@iamakulov
Copy link
Owner

Okay, actually, it appears like Moment partially reverted the change in 2.25.3:

2.25.3

  • Release May 4, 2020

Remove package.json module property. It looks like webpack behaves differently
for modules loaded via module vs jsnext:main.

2.25.2

  • Release May 4, 2020

This release includes ES Module bundled moment, separate from it's source code
under dist/ folder. This might alleviate issues with finding the `./locale
subfolder for loading locales. This might also mean now webpack will bundle all
locales automatically, unless told otherwise.

I’ve started a discussion about this in moment/moment@0c709ba. @akonyer For now, feel free to just upgrade your Moment.js version to solve this 🙌

@akonyer
Copy link
Author

akonyer commented Jun 1, 2020

Awesome, thank you very much. Glad to see that it wasn't something I was doing wrong haha

@akonyer
Copy link
Author

akonyer commented Jun 17, 2020

Hey, I finally got around to testing this out. I tried 2.25.3 as well as 2.26 and it's not working in either version. Again I'm not sure if I'm doing something wrong here, but I am definitely seeing locates in both the /dist/locales and /locales directory with both of these versions.

@iamakulov
Copy link
Owner

iamakulov commented Jul 30, 2020

Hey! Apologies, just got back to this.

Could you please do these three quick things?

  • Run webpack-bundle-analyzer (or source-map-explorer, if you’re using CRA) and attach the screenshot of the generated page here
  • Tell your exact moment.js version (run yarn why moment)
  • And show how you’re importing Moment.js (just copy your imports and paste here)

Thanks! Would love to understand how exactly Moment.js is bundled and what’s the best way I can reproduce this.

@jiangshanglong
Copy link

Hey! Apologies, just got back to this.

Could you please do these three quick things?

  • Run webpack-bundle-analyzer (or source-map-explorer, if you’re using CRA) and attach the screenshot of the generated page here
  • Tell your exact moment.js version (run yarn why moment)
  • And show how you’re importing Moment.js (just copy your imports and paste here)

Thanks! Would love to understand how exactly Moment.js is bundled and what’s the best way I can reproduce this.
I have the same problem,both moment(2.29.3) and moment-locales-webpack-plugin(1.2.0) are latest
1.webpack-bundle-analyze
企业微信截图_1656475414998
2.moment:2.29.3
3.import moment from 'moment';

@std4453
Copy link

std4453 commented Nov 2, 2022

Hi @iamakulov , I'm using moment@2.29.4 and moment-locales-webpack-plugin@1.2.0 here and this problem persists. Just wondering whether we can ignore both locale and dist/locale at the same time, regardless of the version of moment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants