React-datepicker: Module not found: Can't resolve 'react-datepicker/dist/react-datepicker.css' in v2.9.0

Created on 29 Aug 2019  路  23Comments  路  Source: Hacker0x01/react-datepicker

Describe the bug
Looks like the package folder is missing dist folder after 2.9.0 release causing webpack build to fail due to the missing 'react-datepicker/dist/react-datepicker.css' file

image

To Reproduce
Steps to reproduce the behavior:

Install 2.9.0 version and import 'react-datepicker/dist/react-datepicker.css' file in one of your components

Desktop (please complete the following information):

  • OS: Mac

Additional context
Node: 12.9.0
NPM: 6.10.2

bug

Most helpful comment

getting this error on v2.10.1

All 23 comments

same here

Major issue for us atm.
*We are locking to previous.

@mxschmitt Any idea what went wrong here. This might be caused by the refactoring of the release process.

@mxschmitt Any idea what went wrong here. This might be caused by the refactoring of the release process.

I guess it it's because of my refactoring. I will investigate now

I'm observing the same issue on @2.0.0 also. I managed to get rid of the problem locally with npm install style-loader css-loader --save but I still have this issue on Circle CI as

yarn run v1.17.3
$ react-scripts build
Creating an optimized production build...
Failed to compile.

Module not found: Error: Can't resolve 'react-datepicker/dist/react-datepicker.css' ...

same problem on @2.1.0. Hopefully you guys can resolve this)

same problem here, any fix or workaround that you could recommend? Major issue in our deployment now. I鈥檒l try to use @2.9.0 or the previous version for now

same problem, I am facing the same issue in our deployment

Same problem

same problem

I created here a Pr, should fix the build process: https://github.com/Hacker0x01/react-datepicker/pull/1883

But I'm sorry, I don't have much rollup knowledge :/

Thank you for the patch v2.9.1 @mxschmitt , but it doesn't seem to work for me neither Same error. dist folder is created but remains empty.

Can you try this again with v2.9.3?

Thx @martijnrusschen ! All working now 馃挴

Fixed by 98fa95162b51ac523da37c8de66fae05d64ef717. Thanks all!

This package use to work in meteor.js. I install it using: meteor npm install --save react-datepicker
But now I get an error that references react-datepicker.css, here it is:

`/home/2in/Meteor1.6/meteor10-Hydrate/Atrade/node_modules/react-datepicker/dist/react-datepicker.css:1
(function (exports, require, module, __filename, __dirname) { .react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle, .react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle, .react-datepicker__year-read-view--down-arrow,
^

SyntaxError: Unexpected token .
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at npmRequire (/home/2in/Meteor1.6/meteor10-Hydrate/Atrade/.meteor/local/build/programs/server/npm-require.js:133:10)
at Module.useNode (packages/modules-runtime.js:664:18)
at react-datepicker.css (packages/modules.js:433:8)
at fileEvaluate (packages/modules-runtime.js:336:7)
at Module.require (packages/modules-runtime.js:238:14)
at Module.moduleLink [as link] (/home/2in/.meteor/packages/modules/.0.13.0.ibssab.6e4t++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/reify/lib/runtime/index.js:38:38)
at SearchPurchaseHistory.jsx (imports/ui/components/SearchPurchaseHistory.jsx:1:226)
at fileEvaluate (packages/modules-runtime.js:336:7)
at Module.require (packages/modules-runtime.js:238:14)
at Module.moduleLink [as link] (/home/2in/.meteor/packages/modules/.0.13.0.ibssab.6e4t++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/reify/lib/runtime/index.js:38:38)
at router.jsx (imports/ui/router.jsx:1:8256)
at fileEvaluate (packages/modules-runtime.js:336:7)
at Module.require (packages/modules-runtime.js:238:14)
Exited with code: 1
Your application is crashing. Waiting for file change.`

Any ideas? Is this a bug?
Is there a react and meteor specific datepicker I can use if this can't be resolved?

getting this error on v2.10.1

getting the same error on v2.14.1.
Any solutions?

@sommesh i never came across a stable solution so I moved to a different package unfortunately

Okay, kindly let me know does that different package has accessibility support?

Anyway, I did a workaround to fix this.
Just moved the file node_modules/react-datepicker/dist/react-datepicker.css to my local src folder and imported it.

@sommesh I used the same solution. css file didn't load after building. Had to move the file to my local src folder and import it from there.

It's weird since its there somehow: https://unpkg.com/[email protected]/dist/react-datepicker.css

@mxschmitt I'm using version 2.10.0. Could it be related? I didn't want to upgrade yet because 1. I wasn't sure if any breaking changes would affect me 2. I wasn't confident upgrading will fix the bug.
If this bug only happens on versions 2x then I guess it's not a real issue anymore, however I cannot confirm this myself.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

formigone picture formigone  路  3Comments

tamitutor picture tamitutor  路  3Comments

sarav1234 picture sarav1234  路  3Comments

lclemence picture lclemence  路  3Comments

arturictus picture arturictus  路  3Comments