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
Compile with warnings #1220
Comments
This is done on purpose as both |
@albandaft one way to get rid of the warnings is to exclude In the browser you must use the native |
To be honest I'm not even sure why you get the warnings as it should use the shimmed version provided by |
@lpinca The reason why the warnings appear is simple: To test if How to exclude the |
|
@lpinca I get this warning during the react command line building, not in the browser. It is not a matter of shim, it is simply a matter of From https://github.com/websockets/ws/blob/master/lib/BufferUtil.js#L35
|
In Browserify you can use the
Yes but I guess you are creating a bundle for the browser right? |
On the browser everything works fine. I need to remove the warnings because eventually a pipeline build process will fail to pass test if the build exit code is not correct. I am actually running the bundle in memory in watch mode, dev mode. |
try {
const bufferUtil = require('bufferutil');
module.exports = Object.assign({ concat }, bufferUtil.BufferUtil || bufferUtil);
} catch (e) /* istanbul ignore next */ {
...
} That code along with all The |
None of the above worked. |
index.js'use strict';
module.exports = require('remote-redux-devtools'); webpack.config.js'use strict';
module.exports = {
entry: './index.js',
output: {
libraryTarget: 'umd',
filename: 'bundle.js',
library: 'enhancer'
}
}; This doesn't generate any warning with |
@lpinca With your example I do not get either the warnings. Here we get those warning in different machines. We will keep trying to understand... |
Are you requiring |
is there any solution to remove these warnings??? |
Is the warning negligible? Or should we install |
@syang for example:
|
Or: module.exports = {
// [..]
externals: {
bufferutil: 'commonjs bufferutil',
'utf-8-validate': 'commonjs utf-8-validate',
},
// [..]
}; |
I solved this warning by just changing the target in my webpack.config.js to web |
WARNING in /Users/moox/Sync/Development/phenomic/node_modules/ws/lib/BufferUtil.js Module not found: Error: Can't resolve 'bufferutil' in '/Users/moox/Sync/Development/phenomic/node_modules/ws/lib' WARNING in /Users/moox/Sync/Development/phenomic/node_modules/ws/lib/Validation.js Module not found: Error: Can't resolve 'utf-8-validate' in '/Users/moox/Sync/Development/phenomic/node_modules/ws/lib' Ref websockets/ws#1220
Seems a bit weird that if I want to bundle |
@lpinca I don't understand why that is the case. If the two packages are listed in package.json under devDependencies, then clients of the |
@alexleung if you want to use
or
|
Why aren't |
They are dev dependencies because tests must pass with them. If we move them to optional dependencies they are no longer opt-in. Out of curiosity, are you making a bundle for the browser or Node.js? |
I thought the definition of something being optional is that it is opt-in. |
Not for npm, you have to use the |
npm will try and install those optional deps, but if the install fails for those, it wouldn't fail the overall install, which is what you were originally trying to do.
|
Yes, exactly. See 49b1109. This was done because install failed even though they were optional dependencies. Now npm has probably fixed the the issue but I see no good reasons to add them back. What's wrong with externalizing them in webpack config? |
I see. Failing in optional dependencies should not fail the entire installation, but if it was still failing in this case I can understand why it was placed in devdeps. Externalizing these in the webpack config is undesirable because the point of a package/library is to abstract away / encapsulate behavior so you don't need to know how it works, you just use it. Needing to externalize these couple of packages because ws is a transitive dependency of many other libraries (some of which end up being bundled), seems to break the encapsulation that a package typically would provide. Worse it breaks this encapsulation all the way up the dependency tree such that no package which depends on Maybe we could reopen this issue and mark as in-progess until |
Nothing breaks, the warnings are just that and can be safely ignored. The same happen if you try to bundle a library which uses external dependencies in the same way |
This sounds like a bug within npm. |
For me the issue was that I had Switching to |
In general it's bad practice for a library to cause warnings if there is no actual problem, it clutters the console and wastes everyone's time searching for the root cause of a non-issue. This is good enough reason to add back to |
@etienne-martin I'm surprised that you saw the issue at all since #1626 should have fixed the problem. I'd be cautious of switching target to web, because that could cause greater issues if your bundle really is supposed to target node. |
Using this, i solve the warning |
WARNING in /Users/moox/Sync/Development/phenomic/node_modules/ws/lib/BufferUtil.js Module not found: Error: Can't resolve 'bufferutil' in '/Users/moox/Sync/Development/phenomic/node_modules/ws/lib' WARNING in /Users/moox/Sync/Development/phenomic/node_modules/ws/lib/Validation.js Module not found: Error: Can't resolve 'utf-8-validate' in '/Users/moox/Sync/Development/phenomic/node_modules/ws/lib' Ref websockets/ws#1220
Hi guys
I have integrated the tool inside my project and I get this warning while compiling:
This issue is coming from the zalmoxisus/remote-redux-devtools#102, but is a WS library issue.
Basically I notice that the BufferUtil.js check if the library is already present to use it, other use it implements it. The problem is that this will cause
require
to fire an warning.Wouldn't it be better to just include these libraries in the
package.json
or remove totally them from loading?The text was updated successfully, but these errors were encountered: