TypescriptError: Can't resolve "Module not found: #61
-
Hey i have question when i try to import plugins or css compiler returnsCan't resolve "Module not found ... |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
It sounds like an issue we've previously seen with old Webpack / CRA versions here. I can suggest 3 different options to address this issue.
import "yet-another-react-lightbox/dist/styles.css";
import Zoom from "yet-another-react-lightbox/dist/plugins/zoom";
|
Beta Was this translation helpful? Give feedback.
-
1 and 2 do not work, 3rd option is not possible in my project. |
Beta Was this translation helpful? Give feedback.
-
Well, apparently, the solution described here no longer works with YARL v2. Here is the current workaround to make YARL v2 work with CRA 4 and TypeScript. import * as React from "react";
import Lightbox, { Plugin } from "yet-another-react-lightbox";
import Thumbnails from "yet-another-react-lightbox/dist/plugins/thumbnails";
import "yet-another-react-lightbox/dist/styles.css";
import "yet-another-react-lightbox/dist/plugins/thumbnails/thumbnails.css";
import slides from "./slides";
function App() {
const [open, setOpen] = React.useState(false);
return (
<div>
<button type="button" onClick={() => setOpen(true)}>
Open Lightbox
</button>
<Lightbox
open={open}
close={() => setOpen(false)}
slides={slides}
plugins={[Thumbnails as Plugin]}
/>
</div>
);
}
export default App; |
Beta Was this translation helpful? Give feedback.
Well, apparently, the solution described here no longer works with YARL v2.
Here is the current workaround to make YARL v2 work with CRA 4 and TypeScript.