Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Doesn't work with weback #3

Closed
JoshZA opened this issue Apr 2, 2016 · 18 comments
Closed

Doesn't work with weback #3

JoshZA opened this issue Apr 2, 2016 · 18 comments

Comments

@JoshZA
Copy link

JoshZA commented Apr 2, 2016

Default vue-cli webpack build


WARNING in ./~/vue-quill/~/quill/dist/quill.js
Critical dependencies:
6:478-485 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
 @ ./~/vue-quill/~/quill/dist/quill.js 6:478-485

ERROR in ./~/vue-quill/~/quill-render/~/cheerio/index.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./package in C:\node\SerpAdmin\node_modules\vue-quill\node_modules\quill-render\node_modules\cheerio
 @ ./~/vue-quill/~/quill-render/~/cheerio/index.js 11:18-38
@BrockReece
Copy link
Contributor

Hi Josh,

I don't use webpack personally, I could look into it though.
The errors seem to be pointing at 3rd party dependencies, Quill-render and Quill maybe the problem is their end? Is that something you can test as you are more familiar with webpack?

Cheers
Brock

@BrockReece
Copy link
Contributor

cheeriojs/cheerio#832
This PR should fix the issue, we just need to wait for it to be merged.

I hope this helps
Brock

@JoshZA
Copy link
Author

JoshZA commented Apr 4, 2016

Hey Brock,

Thanks for looking into this, I'll wait until it's fixed upstream 👍

@JoshZA JoshZA closed this as completed Apr 4, 2016
@martinhearn
Copy link

@JoshZA add this to webpack config:

 plugins: [
    new webpack.NormalModuleReplacementPlugin(/^\.\/package$/, function(result) {
        if(/cheerio/.test(result.context)) {
            result.request = "./package.json"
        }
    }),

Source

@jefflam
Copy link

jefflam commented Aug 28, 2016

Hi guys, having this issue as well but am not sure how to resolve it. @martinhearn when I added your line to my Webpack plugins it resulted in another error instead...:

ERROR in ./~/babel-loader!./~/eslint-loader!./~/vue-loader/lib/selector.js?type=script&index=0!./~/vue-quill/src/Quill.vue
Module not found: Error: Cannot resolve module 'quill' in /Users/jefflam/Sites/teleo/teleo-fe/node_modules/vue-quill/src
 @ ./~/babel-loader!./~/eslint-loader!./~/vue-loader/lib/selector.js?type=script&index=0!./~/vue-quill/src/Quill.vue 7:12-28

Besides installing vue-quill and adding the above line to webpack config plugins are there any other things that I need to install?

@BrockReece
Copy link
Contributor

Hi @jefflam

It looks like a problem with the quill.js dependency.
What happens if you install quill through npm and try again?

npm install quill

@jefflam
Copy link

jefflam commented Aug 28, 2016

@BrockReece ah, looks like installing quill solved the issue. Interesting...

@BrockReece
Copy link
Contributor

Good to hear that worked, I wonder why npm didn't install it as a dependancy... hmm

@jefflam
Copy link

jefflam commented Aug 28, 2016

Yeah.. I acutally did a 'npm install' again after installing vue-quill just to see if that did anything

@BrockReece
Copy link
Contributor

I have just installed vue-quill in a new webpack project (built through vue-cli) and it has installed both of its dependencies correctly... I'm not sure why that didn't work for you, sorry.

@jefflam
Copy link

jefflam commented Aug 28, 2016

@BrockReece could it possibly be that I installed quill on its own before, and then installed vue-quill after hence resulting in a conflict?

Anyhow, I'm just appreciative of your response and that it is working now. :)

Btw, it's a little side track, but how do I actually pass in the options I want? I don't quite understand base on your documentation.. Is it via 'formats'? For example if I want to add a placeholder, do I do this:

<quill :content.sync="content" :formats="formats"></quill>
data () {
      return {
        content: {
          ops: []
        },
        formats: [{
          name: 'custom',
          options: {
            placeholder: 'Compose note...'
          }
        }]
...
...

@BrockReece
Copy link
Contributor

Possibly, I have known npm to be a bit flakey when juggling different versions of dependancies.

There isn't currently a way to pass through a placeholder in the props, though it is something I can easily add. I am thinking of adding an 'options' prop that be passed through to configure quill, as explained in their docs http://quilljs.com/docs/configuration/

@BrockReece
Copy link
Contributor

Hi @jefflam

I have just pushed a change that allows you to pass a config object through the props which will help you set up a placeholder. There is some instructions for this in the readme, under the configuration header. Give me a shout if you need any more help :)

Cheers
Brock

@jefflam
Copy link

jefflam commented Aug 30, 2016

@BrockReece oh wow, thank you so much for assisting!

I was actually about to comment that it wasn't just passing the "placeholders" though, but also on the whole ability to set up what options I want to give the user for text formatting. For e.g. ['bold', 'italics', ...] etc. Would I also be able to do the same with your new props object?

I will give that a try and let you know if it works :)

@BrockReece
Copy link
Contributor

@jefflam, no problem.

Yep, that new prop should now allow you to set up your formatting whitelist using something like this...

data() {
    config: {
        formats: ['bold', 'italics'],
        placeholder: 'Test...',
    },
}

@martinhearn
Copy link

@BrockReece just a heads-up to say that addModule is removed in v1 so the toolbar will need to be initialised within the config.

@BrockReece
Copy link
Contributor

@martinhearn, thanks for that. I think there is going to be a lot of changes for v1 when it lands. I think it is in RC at the moment.

@jefflam
Copy link

jefflam commented Aug 31, 2016

Hmm for some reason passing the config still doesn't work for me. I suspect it has to do with the version of Quill that is being used in my project though (the fact that I have to install Quill again via npm on top or the vue-quill package).

That being said at this moment it seems like it is something off with my project and node modules.

Looks like there is a new version if Quill upcoming as well. I might just wait for v1 to be released and see how that goes!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants