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

warnings from node_modules code #999

Closed
alok-runner opened this issue Mar 18, 2021 · 3 comments
Closed

warnings from node_modules code #999

alok-runner opened this issue Mar 18, 2021 · 3 comments

Comments

@alok-runner
Copy link

I'm getting this ignored import warning when I have a node module that depends on @material-ui/core.

 > node_modules/@material-ui/pickers/esm/index.js:8:7: warning: Ignoring this import because "node_modules/@material-ui/core/esm/Typography/index.js" was marked as having no side effects
     8 │ import '@material-ui/core/Typography';
       ╵        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   node_modules/@material-ui/core/package.json:51:2: note: "sideEffects" is false in the enclosing "package.json" file
    51 │   "sideEffects": false,
       ╵   ~~~~~~~~~~~~~

I've read that warnings from inside node_modules should be silenced automatically, but I still see this warning.

@evanw
Copy link
Owner

evanw commented Mar 18, 2021

This code is very strange. I'm looking at their repo here and trying to figure out how this happened: https://github.com/mui-org/material-ui-pickers. It looks like maybe this is happening because their build process is ignoring the sideEffects annotation?

Only some warnings inside node_modules are silenced. Warnings related to bundling are not silenced when bundling, since they are really the only way you have of debugging a broken bundle. This has caught real bugs in the past such as tensorflow/tfjs#4248 (comment).

That said, this request seems reasonable and I can try silencing this warning in this case. But I may bring this warning back in the future if someone hits a case where they're getting a broken bundle with esbuild due to an import in a node_modules file with an incorrect sideEffects annotation. In that case (and in the meantime) you can use --log-level=error to silence warnings.

@alok-runner
Copy link
Author

This makes me want more granular logging controls, and perhaps lower logging level for code we don't control.

@evanw
Copy link
Owner

evanw commented Mar 19, 2021

You can get granular logging controls by using the API with logLevel: 'silent' and then filtering the returned warnings array.

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

Successfully merging a pull request may close this issue.

2 participants