Skip to content
This repository has been archived by the owner on Sep 28, 2020. It is now read-only.

errors not shown after starting webpack dev server after initial start #267

Closed
kelly-tock opened this issue Apr 7, 2019 · 14 comments
Closed

Comments

@kelly-tock
Copy link

node 11.12.0
webpack 4.8.2
webpack dev server 3.1.1
eslint-loader 2.1.2

after doing a fresh install, and starting webpack dev server, the loader will properly display lint warnings/errors. I can go through and edit files to fix the issues, and when dev server refreshes, it shows the remaining issues.

if I stop the dev server, then just start it, no warnings/errors are displayed, even though I know there still are some.

{
        enforce: 'pre',
        test: /\.(ts|tsx)$/,
        include: [path.join(cwd, 'src/js')],
        loader: 'eslint-loader',
        options: {
          configFile: '.eslintrc.js',
          emitWarning: true,
          cache: false,
        },
      },
      {
        include: [path.join(cwd, 'src/js')],
        test: /\.(ts|tsx)$/,
        use: [
          {
            loader: 'cache-loader',
          },
          {
            loader: 'thread-loader',
            options: threadLoaderOptions,
          },
          {
            loader: 'babel-loader',
            options: {
              cacheDirectory: true,
              cacheCompression: false,
              babelrc: false,
             .....other stuff
            },
          },
        ],
      },

if I remove cache loader it displays all the time and this issue does not occur.

is there a way to display the issues all the time while using cache loader?

@kelly-tock
Copy link
Author

just to update, I also found that if I add

failOnWarning: true

this issue doesn't occur. however during development, i'm wanting it to still compile, and fix as I go.

we have a pretty large project, so disabling cache loader doesn't seem to be an option for.

@kelly-tock
Copy link
Author

any enabling of cacheing in the loader causes this issue as well. tried cache: true, and failOnWarning: true, but the issue persists.

@tmcdos
Copy link

tmcdos commented Jun 15, 2019

Exactly the same situation here. If I clear the .cache folder, then build the project - I see all linting errors, but if I build twice in a row there are no errors or warnings on the second build.
Any chance to fix this?

@kelly-tock
Copy link
Author

We ended up removing cache loader and turning on cacheing for eslint loader not as fast but ok for now

@hq5544
Copy link

hq5544 commented Aug 16, 2019

The same.

@kelly-tock
Copy link
Author

I found that if you make sure to enable root: true and what not from eslint to make sure it doesn't recursively check for eslint, that gave us a perf boost for sure.

@ricardogobbosouza
Copy link
Collaborator

ricardogobbosouza commented Aug 24, 2019

@kelly-tock Please provide a repository with the issue.

@barberdt
Copy link

barberdt commented Sep 5, 2019

@ricardogobbosouza @kelly-tock

Repro repository provided here: https://github.com/barberdt/loader-issue

Repro steps:

Yarn version: 1.17.3
Node version: 12.9.0

$ git clone [email protected]:barberdt/loader-issue.git
$ cd loader-issue
$ yarn install
$ yarn run test
  • Observe the output of the single eslint error:
ERROR in ./index.js
Module Error (from ./node_modules/eslint-loader/dist/cjs.js):

/Users/davis/github/loader-issue/index.js
  1:13  error  'foo' is not defined  no-undef

✖ 1 problem (1 error, 0 warnings)

ℹ 「wdm」: Failed to compile.
  • Kill the dev server
  • Start the dev server again (yarn run test)
  • Observe a successful build instead of seeing the expected error.

Restarting the server from this point forward should continue to show a false successful build.

Without having dug into the issue itself, I'm not 100% sure which repo this issue belongs to between eslint-loader, cache-loader, babel-loader, webpack, and webpack-dev-server, but this was the most fleshed out of the related issues, so I thought I'd post here. Happy to move this repro around wherever needed.

@kelly-tock
Copy link
Author

Thanks for providing this!

@ricardogobbosouza
Copy link
Collaborator

ricardogobbosouza commented Feb 21, 2020

Hi @barberdt, @kelly-tock
Thanks for reporting, sorry for the late reply

I do not recommend using cache-loader and eslint-loader together, use the cache option
But if you want to use both together, enable the failOnError option.

Soon this loader will be deprecated in favor of this plugin eslint-webpack-plugin

@kelly-tock
Copy link
Author

I am using typescript so recently switched raking over to be handled by fork ts checker plugin

@onebree
Copy link

onebree commented Apr 28, 2020

@ricardogobbosouza Which loader exactly will be deprecated? Caching or ESLint? When will that deprecation happen, and is there a guide present for moving from one to the new plugin?

@ricardogobbosouza
Copy link
Collaborator

Hi @onebree

  • We are analyzing the depreciation of the eslint-loader
  • We will be launching v1.0.0 of eslint-webpack-plugin until this weekend

@ricardogobbosouza
Copy link
Collaborator

Please use eslint-webpack-plugin. eslint-loader will be deprecated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants