CrazyTim / spin-wheel

An easy to use, themeable component for randomising choices and prizes.
https://crazytim.github.io/spin-wheel/examples/themes
MIT License
174 stars 45 forks source link

Can't import in node Vue? #25

Closed blkhwks19 closed 9 months ago

blkhwks19 commented 9 months ago

I'm trying to install and import this into a node Vue project and I keep getting an error that the module cannot be resolved.

My command to install: npm install spin-wheel

My code to import: import { Wheel } from "spin-wheel";

Error I get: Module not found: Error: Can't resolve 'spin-wheel' in 'C:\Projects\Web\wheel-test\src'

I've checked package.json and it's definitely in there: "spin-wheel": "^4.3.0",. I'm getting the error before I've even begun to setup the config and initialize it. It can't even find the module. Is there a preferred way to import this that I'm missing?

blkhwks19 commented 9 months ago

I was importing incorrectly. The correct way to import is: import { Wheel } from "spin-wheel/src/wheel";

CrazyTim commented 8 months ago

Hey @blkhwks19, thanks for raising this!

I did notice a simular error when building for production in a Vue 3 app. It was because there was no entrypoints defined in package.json. This has been fixed in v4.3.1 so hopefully it will make it easier to import and bundle now.