ankurk91 / vue-trumbowyg

Vue.js component for Trumbowyg WYSIWYG editor :memo:
https://ankurk91.github.io/vue-trumbowyg/
MIT License
236 stars 35 forks source link

Cannot find module 'trumbowyg/dist/ui/icons.svg' #1

Closed nilsi closed 7 years ago

nilsi commented 7 years ago

Hi @ankurk91,

Thank you for this package.

Im getting an error with Meteor + VueJS. I dont know why the import doesn't work but it looks like the path is right and the icons.svg file exist intrumbowyg/dist/ui/icons.svg.

I read in the documentation that I can configure SVG path manually by $.trumbowyg.svgPath = '/assets/my-custom-path/icons.svg'; But Im not sure how I can access $.trumbowyg.

Was thinking if you had ran into something similar?

ankurk91 commented 7 years ago

@nilsi Hmm, interesting. You no need to specify .svg path yourself, the Vue component is doing that for you.

I believe this is not the loader configuration issue. Can you confirm that trumbowyg is installed as top level package.

npm ls --depth=0

I also believe you are using webpack, right ?

P.S. I have proper webpack loader configured here,see https://github.com/ankurk91/vue-trumbowyg/blob/master/webpack.config.dev.js#L49-L50

Can you share exact error message you get on terminal ?

nilsi commented 7 years ago

Thank you.

Trumbowyg was installed as a top level package. Actually Meteor using their own build tools and not Webpack. It turns out they don't support importing SVG files like this.

I did put the icons file in Meteors public folder, added the component.vue directly to my project and changed initiation to: this.el.trumbowyg(Object.assign({svgPath: "/icons.svg"}, this.config)); and it did work.

Not sure how I can make this prettier but maybe I should pick pieces out of your package and customize it myself.

ankurk91 commented 7 years ago

I won't recommend editing inside node_modules but for meanwhile you can import like this

import trumbowyg from "vue-trumbowyg/src/component.vue"

now if you make any change in component.vue file it should reflect. If that works for you then you can copy that .vue file inside your project and start using it.

I can not help you in importing .svg file, no idea of meteor and its build tool.

nilsi commented 7 years ago

Yes I will look in your package for inspiration from now on and use component.vue. If theres more people having this issue it would make sense to let them set the SVG path with a prop. Closing for now.