Please help me understand what is causing the error message below.
I'm trying to migrate a project to Snowpack, having used create-react-app previously. In this project I am using a library called react-konva for some canvas stuff. This library works fine when used in create-react-app, but when I try to use it with snowpack I get this error:
Uncaught SyntaxError: The requested module '../web_modules/react-konva.js' does not provide an export named 'Rect'
I error above was raised by this snippet:
import { Layer, Rect, Stage } from 'react-konva';
const ReactKonvaTest = () => {
return (
<>
<Stage width={800} height={500}>
<Layer>
<Rect width={200} height={100} strokeWidth={10} stroke="#222" />
</Layer>
</Stage>
</>
);
};
function App() {
return (
<div className="App">
<ReactKonvaTest />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
}
export default App;
The same snippet does not cause any problems when used in a project initialized with create-react-app.
I don't understand whats causing it. Im not sure what ../web_modules/
directory in the error message is referring to. I have not heard of it before, and my searches haven't yielded any relevant matches.
It is fixed with react-konva@17.0.1-1