Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requiring CSS causes error in default vue-webpack template. Importing them does not. #95

Closed
mariojankovic opened this issue Oct 14, 2017 · 5 comments

Comments

@mariojankovic
Copy link

mariojankovic commented Oct 14, 2017

First of all, thank you for this amazing port. I'm not a native chinese speaker so I had to clear the default issue template. :)

This is the error I get when I try to import vue-quill as it is:

ERROR in ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./~/vue-quill-editor/src/editor.vue
Module not found: Error: Can't resolve 'style-loader' in '/Users/mario/project'
 @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./~/vue-quill-editor/src/editor.vue 9:0-36
 @ ./~/vue-quill-editor/src/editor.vue
 @ ./~/vue-quill-editor/index.js
 @ ./src/main.js
 @ multi ./build/dev-client ./src/main.js

I've noticed you used require to import the default CSS styles for quill (editor.vue lines 9-11). At the bottom of the editor.vue file there seems to be a <style> attribute already, so what I did is I just imported all of the default quill styles using the default css @import method instead of using require. Now I'm curious -- why did you use require in the first place? Is importing them wrong?

In any case, it works for me so If you want I can make a pull request with the above mentioned changes?

Thanks!

@mariojankovic
Copy link
Author

After thoroughly testing this and fixing the above mentioned issue by installing the missing style-loader or rather replacing it with vue-style-loader in my webpack.config file, I did investigate further and there seems to be no real difference between importing and requiring a CSS file. Can you confirm? Seems to me that importing CSS is still easier than requiring.

@surmon-china
Copy link
Owner

Thank you for your feedback!

In the previous test, in the .vue component style import quill css, need to use the path alias, I am not sure everyone's webpack project alias is the same, it may lead users to manually modify the webpack config; if the use of webpack require the webpack resource management model, so use this way, but in some users of the project did not add style-loader similar to the analysis of such rules, so there have been some people encountered such a mistake, if you have Comprehensive test and guarantee .vue style import quill css form node_modules is available in any case, then welcome you to submit PR! In addition, the components in the browser when the package is compiled, you need to comment out css related reference, or css will be packaged into the production model of the building package.

#10
#8

@mariojankovic
Copy link
Author

Thanks! Since I managed to figure it out, I guess we can close this issue for now. :)

@ashitvora-zz
Copy link

How did you fix it?

@mariojankovic
Copy link
Author

Please read my first comment:

installing the missing style-loader or rather replacing it with vue-style-loader in my webpack.config file

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

No branches or pull requests

3 participants