Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Lacking Webpack integration #19

Open
alex996 opened this issue Jan 20, 2018 · 12 comments · May be fixed by #46
Open

Lacking Webpack integration #19

alex996 opened this issue Jan 20, 2018 · 12 comments · May be fixed by #46

Comments

@alex996
Copy link

alex996 commented Jan 20, 2018

The package cannot be imported in a Webpack setup: import moment from 'moment-holiday yields Error: Cannot find module ".". A require calls does not succeed either. Could you add support for Webpack?

P.S. Originally discovered in the context of create-react-app.

@alex996
Copy link
Author

alex996 commented Feb 3, 2018

Tried import 'moment-holiday', it seems to work sparingly, depending on the webpack config. Any clues?

@alex996 alex996 closed this as completed Feb 3, 2018
@alex996 alex996 reopened this Feb 13, 2018
@almadsen
Copy link

Plus one for this. I'm trying to use this with react, won't work, getting lots of web pack related errors.

@AndrewLane
Copy link

Seeing this as well...

@thabelo
Copy link

thabelo commented Mar 23, 2018

Hey, this seems to be a huge problem for us using react can you please show us how to fix this. Thanks

@maxkohl88
Copy link

Running into this too. Great library, but can't use it due to incompatibility with Webpack.

@natefoundry
Copy link

Also ran into this trying to use in React App.

Is there a workaround?

@kgrosvenor
Copy link

Cant import

@anonet1
Copy link

anonet1 commented Sep 18, 2018

Workaround is to go to node-modules (moment-holiday folder, file:moment-holiday.min.js) and replace:
“undefined”==typeof require||nul===require||require.amd?this.moment:require(“moment”)

with this line:

require("moment")

@kgrosvenor
Copy link

kgrosvenor commented Sep 18, 2018

@Anetk we don't really want to modify node_modules as most of the time we delete this before we commit js projects

@alex996
Copy link
Author

alex996 commented Oct 24, 2018

@kgrosvenor Fork the .min file to your project then, so you can fix the requires there.

joeldenning added a commit to joeldenning/moment-holiday that referenced this issue Aug 7, 2019
@joeldenning
Copy link

I have created a fork that is usable via webpack: https://github.com/joeldenning/moment-holiday.

Installation:

npm install --save https://github.com/joeldenning/moment-holiday\#1.5.2-webpack.0

@jaketrimble
Copy link

jaketrimble commented Aug 31, 2019

@joeldenning thanks for the fork! Also you may want to update your documentation to:

yarn add joeldenning/moment-holiday\#1.5.2-webpack.0

per yarnpkg/yarn#2083 (comment)

Cheers!

@alex996 alex996 linked a pull request Nov 30, 2019 that will close this issue
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants