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
Module not found: Error: Can't resolve '../moment' with Webpack and TypeScript #4945
Comments
Thanks for opening this request. |
This is a bug, isn't it? Stack Overflow is good for question, but nobody will fix bugs there. I interpret your answer to mean that you do not support WebPack with TypeScript. Too bad! |
There are various tutorials on the internet about using Moment with Webpack and TypeScript. It seems that many others use them together just fine. If more people have this issue, and there is enough community knowledge to fix it, then we can try to do so. |
I had the same problem by the way - seems to be caused by moment locales, which I didn't care about. I found a solution in this online article, which was good enough in my case, to ignore the locales plugin: plugins: [ This seems like a pretty mainstream usage scenario, so I'd recommend linking to the above page from the TypeScript section of the docs. |
@authguidance-examples PRs are welcome at https://github.com/moment/momentjs.com ! |
I was facing the same issue, here was the issue-
|
anyone know why always show like "a few seconds ago"? whatever the date is it |
i added the moment in reactjs : import * as moment from "moment"; and in the dependecy injection added : "moment": "2.23.0", but getting the undefined error... in reactjs, |
Why isn't this branch closed? Last comment on December 2nd, 2019. @marwahaha |
Describe the bug
If I try to compile my TypeScript app with webpack, I get an error for each locale that '../moment' can't be resolved.
This error is repeated for every other locale:
To Reproduce
src/app.ts
package.json
tsconfig.json
webpack.config.js
Expected behavior
yarn run webpack -p
should work without any error.Moment-specific environment
Please run the following code in your environment and include the output:
This code fails with the same errors!
The text was updated successfully, but these errors were encountered: