Skip to content

Provide a way to mute warnings that can only be fixed with access to configuration #4263

Closed

Description

@gaearon

Create React App doesn't expose Webpack configuration to the users, so any Webpack warnings that require fixes in config are non-actionable for our users. Unless they are critical (but in this case they should be errors), I would like to have an option to mute them.

#1617 is a good example of such warning. Create React App users have no control over it (when caused by third party libraries shipping a pre-built file). Just adding a noParse option wouldn't work for them because they can't change the config. For this warning specifically, there are also some users who consciously choose to use precompiled files (e.g. for build speed), so I'm not sure it's entirely relevant in all cases.

Another example of this being inconvenient is that this warning causes CI to fail for our users. We use eslint-loader and due to popular demand configured CI script to treat ESLint warnings as errors on CI. Unfortunately this also means unactionable Webpack warnings break the build. (react/create-react-app#1150)

Would you consider a feature request of muting warnings that are only actionable for people with access to the config?

Activity

  1. sokra commented on Feb 12, 2017

    @sokra
    Member

    An option to suppress warnings make sense.

  2. sokra commented on Feb 12, 2017

    @sokra
    Member

    Maybe:

    suppressWarnings: [
      /prebuild/,
      path.resolve(__dirname, "app/file.js")
    ]
  3. bebraw commented on Feb 12, 2017

    @bebraw
    Contributor

    I might put it below output so that you would end up with output.supressWarnings.

  4. justsml commented on Feb 21, 2017

    @justsml

    @sokra 👍
    I really like this pattern.

    @bebraw However, don't add it to output - it confuses the purpose of that configuration object.

    While it sounds right at first, on second thought I feel this feature deals more with console output - not chunking/hashing/building output.

  5. justsml commented on Feb 21, 2017

    @justsml

    And as @gaearon points out, it'd need to be external to the normal build configuration...

    An environment value to optionally turn ON debug warnings would be ideal for my uses; however supporting this kind of config in the package.json would be awesome as well.

    @sokra is that kinda what you were thinking?

  6. gaearon commented on Feb 21, 2017

    @gaearon
    ContributorAuthor

    In my case, I'm fine with this being in configuration because I as a tool-maker can set it up.

  7. justsml commented on Feb 21, 2017

    @justsml

    @gaearon - I guess I should clarify - which configuration?
    webpack.js or package.json or?

  8. gaearon commented on Feb 21, 2017

    @gaearon
    ContributorAuthor

    I have full access to a regular Webpack config, but people using my package (that builds on top of Webpack) don't.

  9. justsml commented on Feb 21, 2017

    @justsml

    Webpack config is an executed .js - so it doesn't lend itself to fitting neatly in other toolchains.

    Environment variables however would allow for more freedom to control the output when running in a Continuous Integration server, in 3rd party tools, or docker-based build chains.

  10. justsml commented on Feb 21, 2017

    @justsml

    In the case described regarding Create React App, could this be solved by letting you define a webpack overrides key in package.json?
    So you could access noParse and possibly other needed overrides?
    Idk, I might be making too many assumptions about CRA's config & usage of webpack.

    Has this been discussed? Move this over to Create React App issues?

    My original issue wouldn't be solved. My use case is I'm trying to combine code from several teams into a single product w/o me materially changing anything.
    My access is limited to the CI server & it's build env vars.

  11. sokra commented on Feb 21, 2017

    @sokra
    Member

    It will be in configuration. CRA can decide if they expose it as environment variable. I don't think this is needed but feel free to expose it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions