remotelock / react-week-scheduler

A time grid component for React with scheduling capabilities.
https://remotelock.github.io/react-week-scheduler
MIT License
139 stars 58 forks source link

How to build this library #14

Closed aliechti closed 5 years ago

aliechti commented 5 years ago

Hi, I'm using webpack with typescript and have some problems.

error  in ./node_modules/@remotelock/react-week-scheduler/index.mjs

Can't import the named export 'useRef' from non EcmaScript module (only default export is available)

I tried to fix it with this (found here https://github.com/graphql/graphql-js/issues/1272):

// webpack.config.js
{
  test: /\.mjs$/,
  include: /node_modules/,
  type: "javascript/auto",
}

Which fixed the build, but then I got another error in the browser:

Uncaught TypeError: Object(...) is not a function
    at TimeGridScheduler (index.mjs:1251)

image

Do you have any hint what I should try to get it to work?

forabi commented 5 years ago

@thejahweh Hey Adrian! Thanks for opening this issue. We use this in production and we have the same webpack rule applied so I'm really surprised this does not work for you. Can you share more details on your setup? Maybe webpack config and package versions?

aliechti commented 5 years ago

Thanks, the information that you use it this way already and it works helped me allot. So I knew it wasn't the build process.

The problem was the incorrect react version, I've upgraded to 16.8.4 and now it works 👍

forabi commented 5 years ago

Glad it worked!