unexpected console statement errors in production build pwa after recent update



  • I updated quasar and npm dependencies to latest revision and now I’m receiving this error when trying to build a pwa:

    quasar build -m pwa

    ERROR in ./src-pwa/register-service-worker.js
    Module Error (from ./node_modules/eslint-loader/index.js):

    C:\Data\projects\rattler\src-pwa\register-service-worker.js
    16:5 error Unexpected console statement no-console
    20:5 error Unexpected console statement no-console
    24:5 error Unexpected console statement no-console
    28:5 error Unexpected console statement no-console
    32:5 error Unexpected console statement no-console
    36:5 error Unexpected console statement no-console
    42:5 error Unexpected console statement no-console

    ✖ 7 problems (7 errors, 0 warnings)

    @ ./.quasar/client-entry.js 101:0-48
    @ multi ./.quasar/client-entry.js



  • How did you update quasar?

    Scott



  • npm update

    in the project directory…
    I manually commented out all the console statements in src-pwa/register-service-worker.js to circumvent



  • Could you please run quasar upgrade and copy the info that it says here?

    Scott



  • Sure…

    C:\Data\projects\rattler>quasar upgrade
    Quasar CLI · Gathering information with npm…
    Congrats! All Quasar packages are up to date.
    C:\Data\projects\rattler>



  • If you could, please try installing yarn, removing any .lock files along with the node_modules folder and then running yarn install.

    We highly recommend using Yarn for local package mangement, as Yarn has proven to be much more stable for Quasar than npm.

    Scott



  • Thanks Scott. I don’t like yarn. The problem appears to have been a file checked into the release with console statements that was part of the production build. I’m not sure yarn would have made a difference. Would it?



  • Possibly. Not sure. What’s not to like about Yarn?

    Scott



  • If youre on a windows os, then you should use yarn, npm having issues with local deps. Anywhoo, try to comment the bottom settings about console logs in your .eslintrc file. @Kentskyo



  • I’m in the “if it’s not broke don’t fix it” mode for package managers, I haven’t run into any specific problems with npm on quasar thus far. If there are issues, I would hope they would be documented in the install page. Likewise if there’s a sunset date for npm being supported. I prefer not to disable the warnings in .eslintrc, they seem useful for flagging issues like this and I’d like to be aware of them when they happen



  • NPM works just fine. No need to create FUD.
    This behaviour seems expected. Linter is checking register-service-worker.js and has a no-console rule for production environment.
    You can solve it by any of these (and probably other) means:

    • removing the logs
    • disabling linter for that file (or only disable this specific rule)
    • allowing all logs in production
    • changing no-console severity to warn instead of error
    • not linting during build

      profit?


  • @Arto we’re not advocating yarn or fud, we just have many past reports that yarn solved somehow on windows platform. If npm works for you, then do use it (we useit too) :).


Log in to reply