-
Notifications
You must be signed in to change notification settings - Fork 930
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
WebPack related error #7
Comments
This may be the webpack's bug. I include the quill.js in |
Quill specifies the precompiled distributable as its main script, but that shouldn't generate an error, rather a warning such as this:
Which is unfortunate, but not under my control, as quill doesn't ship Also, I'm understanding that you are requiring Try, and let me know if that fixes it. By the way, you can use module: {
noParse: /node_modules\/quill/
} |
HI, @zenoamaro. My webpack config is from https://github.com/steida/este/blob/master/webpack/makeconfig.js, with this line Yes, I did not require('quill') directly. I think webpack got an error because of this line https://github.com/zenoamaro/react-quill/blob/master/src/mixin.js#L3. I had to remove this line to avoid the build errors. |
Ah, you can see here that Este is throwing on warnings in production: webpack(webpackConfig, function(fatalError, stats) {
var jsonStats = stats.toJson();
var buildError = fatalError || jsonStats.errors[0] || jsonStats.warnings[0];
if (buildError)
throw new gutil.PluginError('webpack', buildError); This may be questionable or not, depending on your preferences on the matter, but it is not a fault in react-quill, rather quill's for distributing a minified script as its main. I can see two things that you could do:
I highly recommend you follow the second suggestion, as that is the right way to feed pre-built scripts to webpack, and would allow you to keep a warning-free production build, or at least handle the issue explicitly. Anyway, closing this as it's not something that can be solved inside react-quill. Thanks for the report, and let me know if this worked for you. |
Thank you @zenoamaro for your kind explanation. It's worked. I like the source code of react-quill. It's very easy to read and a good material to learn how to wrap the other-world javascript. And thank you for introducing the hidden parts of webpack. |
Thanks! And remember that, if you like this library, contributions for missing features or bugs are always welcome! |
When using module: {
noParse: /node_modules\/quill/,
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loaders: ['babel'] },
{ test: /\.json$/, loader: 'json-loader'},
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style', 'css!autoprefixer!rework'/*,
{
publicPath: '/public/css/'
}*/
)},
{ test: /\.(jpg)$/, loader: 'file-loader' },
{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=10000' }
]
}, The app will error out saying that require is not defined in /node_modules/react-quill/quill/index.js This is because module.noParse expects to have no call to require, define or similar : module.noparse I changed noParse to /node_modules/quill/dist/ to fix the error. @zenoamaro are you aware of this? |
Thanks for noticing. Yes, it makes sense to limit I added a note about this on the README. |
If you are requiring any of the css files from the quill dist, you'll get more webpack errors complaining about require being undefined:
To fix this, I had to update the |
Hi, @zenoamaro I am trying to use react-quill by using react-quill.js but throws me a error at Quill: Potentially unhandled rejection [2] TypeError: Quill is not a function
Not using webpack, most likely the reason its showing this error.... is there a file that can include to use react-quill where I don't need to use webpack, simply don't know how use it... help would be much appreciated... in case of using react-quill.min.js the error is: |
@tamagokun What did you end up using as your REGEX statement? I've been struggling with this and can't find a statement that will remove this warning. I would think it would be |
@markmiller21 here's what I used: noParse: /node_modules\/quill\/dist\/quill\.js/, Looks like you just need to escape your "." since it is a special char in regex. |
None of these regex works for me. This is the modules section of my webpack configuration: module: {
noParse: /node_modules\/quill\/dist/,
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['react-hot-loader', 'babel']
}, {
test: /\.sass|\.css/,
loaders: [ 'style', 'css', 'sass' ]
}]
} Did something change in he meantime or am I the only one still getting this warning? |
Are you on Windows? We had issue with regex as well and changed like so: var path = require('path');
...
module: {
noParse: [
path.resolve('node_modules/react-quill/node_modules/quill/dist/quill.js'), //npm 2
path.resolve('node_modules/quill/dist/quill.js') //npm 3
], |
Yes I'm on windows and it worked. Thanks! :) |
I am on Linux and still getting the error ./ |
@tamagokun 's solution was all the fix I needed in our project! I'm amazed at how hard it was to get thist to work out of the box (well, almost) with Webpack. Thanks! |
Hi, @zenoamaro I got an error with webpack.
Related code is
The text was updated successfully, but these errors were encountered: