3

I am trying to integrate react epub reader with Next Js but getting one error and works well with react js, I need your help to integrate epub reader with next js

error

My code

import React from 'react';
import { ReactReader } from "react-reader";

export default function Home() {
  return (
    <div>
         <div style={{ position: "relative", height: "330px" }}>
<ReactReader
        url="./Boy without a name English.epub"
        title={"Alice in wonderland"}
        location={"epubcfi(/6/2[cover]!/6)"}
        locationChanged={epubcifi => console.log(epubcifi)}
      />
    </div>
  </div>
  )
}
1

1 Answer 1

0

The issue can be fixed by transpiling react-reader and epubjs modules (exported as ESM since a few months back).

For example, using next-transpile-modules in Next.js config:

// next.config.js
const withTM = require("next-transpile-modules")(["react-reader", "epubjs"]);

module.exports = withTM({/* custom config */});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.