kodie / moment-holiday

A Moment.js plugin for handling holidays. NO LONGER MAINTAINED (DEPRECATED)
MIT License
83 stars 86 forks source link

Lacking Webpack integration #19

Open alex996 opened 6 years ago

alex996 commented 6 years ago

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 commented 6 years ago

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

almadsen commented 6 years ago

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

AndrewLane commented 6 years ago

Seeing this as well...

thabelo commented 6 years ago

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

maxkohl88 commented 5 years ago

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

natefoundry commented 5 years ago

Also ran into this trying to use in React App.

Is there a workaround?

kgrosvenor commented 5 years ago

Cant import

anonet1 commented 5 years ago

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 commented 5 years ago

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

alex996 commented 5 years ago

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

joeldenning commented 4 years ago

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 commented 4 years ago

@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 https://github.com/yarnpkg/yarn/issues/2083#issuecomment-525335592

Cheers!