DCzajkowski / vue-emoji-picker

Very simple, yet powerful, vue emoji picker 🎉🔥🚀
MIT License
332 stars 49 forks source link

Add typescript definition #2

Closed Edza closed 6 years ago

Edza commented 6 years ago

The workaround is with a local type.

All you need is this line: declare module 'vue-emoji-picker';

Inside a "vue-emoji-picker" folder, which is in the typeRoot.

In tsconfig.json. "typeRoots": ["./src/types"],

DCzajkowski commented 6 years ago

I'll have a look into that later. Feel free to make a PR if you feel like doing so 😉

Edza commented 6 years ago

Thanks. Sure thing, but would I actually have to figure out where to place it from the component perspective.

Edza commented 6 years ago

Alright, so I forked it, but the "npm run browser-build" is throwing an error:

$ npm run browser-build

> vue-emoji-picker@1.0.0 browser-build C:\Users\edza\Desktop\emoji-picker-fork\vue-emoji-picker
> cross-env NODE_ENV=production browserify -g envify -p [ vueify/plugins/extract-css -o dist/vue-emoji-picker.css ] -e src/main.js | uglifyjs -c warnings=false -m > dist/vue-emoji-picker.js

The system cannot find the path specified.

I installed browserify, envify, and uglifyjs globally, but it did not help.

npm run build works fine.

npm run dev:

ERROR in ./src/Components/EmojiPicker.vue
Module not found: Error: Can't resolve 'vue' in 'C:\Users\edza\Desktop\emoji-picker-fork\vue-emoji-picker\src\Components'
 @ ./src/Components/EmojiPicker.vue 21:17-31
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js

🤔

DCzajkowski commented 6 years ago
  1. It's connected to you using Windows. Unix-based systems use /, whereas Windows uses \. I am not sure how to fix that as I don't have a Windows machine at home. Try using some Bash emulator like Git's terminal.
  2. For your purposes you don't need to build for a browser. It sucks the dev command doesn't work either. But the build one should be sufficient.
Edza commented 6 years ago

It was a missing dist folder. :D

I am using a bash emulator.

npm run dev still struggling 🤔:

ERROR in ./src/Components/EmojiPicker.vue
Module not found: Error: Can't resolve 'vue' in 'C:\Users\edza\Desktop\emoji-picker-fork\vue-emoji-picker\src\Components'
 @ ./src/Components/EmojiPicker.vue 21:17-31
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
Edza commented 6 years ago

Can't resolve what's not there. Fixed with: npm i -D vue

Edza commented 6 years ago

Done.

https://github.com/DCzajkowski/vue-emoji-picker/pull/3

DCzajkowski commented 6 years ago

https://github.com/DCzajkowski/vue-emoji-picker/releases/tag/1.0.1