react-datetimerange-picker: Failed to compile

@wojtekmaj great component! I like it a lot.

One small problem that it can’t compile. Using the import suggested on your docs the module cannot be found:

Module not found: Can't resolve '@wojtekmaj/react-datetimerange-picker' in ...

If I use:

import DateTimeRangePicker from '@wojtekmaj/react-datetimerange-picker/src/entry'

Then I get:

Module not found: Can't resolve './DateTimeRangePicker.css' in '/path/here/node_modules/@wojtekmaj/react-datetimerange-picker/src'

Edit:

Using the entry.nostyle version also fails to compile:

./node_modules/@wojtekmaj/react-datetimerange-picker/src/DateTimeRangePicker.jsx
Module parse failed: Unexpected token (30:8)
You may need an appropriate loader to handle this file type.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 18 (6 by maintainers)

Most upvoted comments

Same issue here except I’m using the react-daterange-picker version 3.0.0.

Global CSS cannot be imported from within node_modules.
Read more: https://err.sh/next.js/css-npm
Location: ../../node_modules/@wojtekmaj/react-daterange-picker/dist/entry.js

Using the react-calendar (version 3.1.0) works by importing the styles manually. Using that with selectRange prop and custom input in the meanwhile 😊

Developing next js project with versions: “next”: “^9.2.2”, “react”: “^16.8.6”,

Oh! @taylorj91 You’re not using this package 😄 This is @wojtekmaj/react-datetimerange-picker, and you’re talking about react-datetime-range-picker 😃

ERROR in ./node_modules/@wojtekmaj/react-daterange-picker/dist/DateRangePicker.js Module not found: Error: Can't resolve 'react-date-picker/dist/DateInput' in '/opt/atlassian/pipelines/agent/build/node_modules/@wojtekmaj/react-daterange-picker/dist' @ ./node_modules/@wojtekmaj/react-daterange-picker/dist/DateRangePicker.js 24:40-83 @ ./node_modules/@wojtekmaj/react-daterange-picker/dist/entry.js

package.json -> “@wojtekmaj/react-daterange-picker”: “4.0.0”,

I started facing this issue recently, my react application building fine in local but error occurs in bitbucket pipeline

your welcome

thank you for all of the amazing components you’ve built,

your time, talent, and effort is greatly appreciated!

Thanks for pointing that out - the one with @ is correct. Fixed README.

I had this problem then I have installed it with version number and it worked.

npm install @wojtekmaj/react-datetimerange-picker@2.3.0

I was not having dist folder without version number

Module not found: Can't resolve '@wojtekmaj/react-datetimerange-picker' in ... sounds like the module is not installed properly.

You definitely shouldn’t use .../src/entry. Entry file from src will not work; it requires a CSS file which is compiled after JS files are copied and compiled with Babel. You should be able to just import @wojtekmaj/react-datetimerange-picker.

../src/entry.nostyle will also not work if you have excluded node_modules from compiling with Babel (which you totally should have done, so don’t worry).

Please check if @wojtekmaj/react-datetimerange-picker module even has dist folder in it! If not, try reinstalling the package.