Skip to content

yet-another-react-lightbox with Remix app #122

Answered by igordanchenko
neriasudai asked this question in Q&A
Discussion options

You must be logged in to vote

Apparently, Remix is unable to import ESM packages by default.

https://remix.run/docs/en/1.16.0/pages/gotchas#importing-esm-packages

To fix this, you need to add yet-another-react-lightbox to the serverDependenciesToBundle option in your remix.config.js file. Please note that I'm using regex that also covers plugins imports.

/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
  ignoredRouteFiles: ["**/.*"],
  unstable_dev: true,
  serverDependenciesToBundle: [/^yet-another-react-lightbox.*/],
};

Here is a working example - https://codesandbox.io/p/sandbox/yet-another-react-lightbox-122-qsgufv?file=%2Fapp%2Froutes%2Findex.tsx

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@neriasudai
Comment options

@igordanchenko
Comment options

@neriasudai
Comment options

@igordanchenko
Comment options

@neriasudai
Comment options

Answer selected by igordanchenko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants