-
Notifications
You must be signed in to change notification settings - Fork 4k
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 WARNING: "Critical dependencies: This seems to be a pre-built javascript file. ..." #360
Comments
First of all, as this is only a warning, you could just ignore it. From my understanding, you are getting this error because the dist/clipboard.min.js and dist/clipboard.js files are pre-built javascript files, which means they are generated using babel and browserify, and are not just the original source code of the module itself. What you could do to prevent this warning is to simply use the lib/clipboard.js file instead of the dist/clipboard.min.js file, like so: module.exports = {
entry: "./entry.js",
output: {
path: __dirname,
filename: "bundle.js"
},
resolve: {
alias: {
clipboard: 'clipboard/lib/clipboard.js'
}
}
}; (Note: most of the solution was taken from zenorocha's web pack config example) If this solution doesn't work for you or you still have questions, feel free to let me know. |
@itaisteinherz, thank you for your reply.
Does it mean that babel + browserify generate the pre-built files in some specific way and webpack is not satisfied with that?
|
@ditransler I think that the problem is due to browserify and not babel. As you said above, browserify generates a bundle of all of the dependencies into a single file, so webpack doesn't have anything to build. Because of that, webpack will bundle the generated browserify bundle as-is. |
@itaisteinherz, I see. Thank you. I read some comments saying that settings used to bundle scripts may differ and the output may be different as the result of it. That's why I've finally found another solution: We can use the module.noParse parameter in webpack to suppress this warning:
Now there's no warning in the console. |
Main point
I'm getting the following warning in webpack while bundling:
What I use
Webpack config's excerpt
Expected behaviour
This warning shouldn't appear in the console.
It draws extra attention and becomes irritative. Especially as it's the only dependency that produces this warning.
Moreover, I don't want to suppress all warnings in webpack (possibly missing some valuable warnings).
What I tried to change
Side note
I found out that this warning appeared in other libraries:
But my other plugins are required the same way and they don't trigger this warning:
Please, help me. I'll really appreciate it.
The text was updated successfully, but these errors were encountered: