DEV Community

smac89
smac89

Posted on β€’ Edited on

4 2

Forcing webpack to recompile your files

Just today I started noticing that when my react code rebuilds, I get eslint errors in the console, but not in my IDE.

Even stranger was the fact that when I run eslint by itself in the commandline, it doesn't show that anything was wrong:

eslint --cache --format stylish --ext '.js,.jsx,.ts,.tsx' --quiet ./
Enter fullscreen mode Exit fullscreen mode

What gives?

Come On Reaction GIF

The solution

touch command to the rescue. In order to force webpack to recompile the files, they had to be changed somehow, and I wasn't prepared to manually change each file by hand, recompile, and revert the change, just to wait for another recompilation.

I simply used the touch command on Linux to "touch" all the files which were having that problem, like so:

touch src/pages/**/*.{js,jsx,tsx,ts}
Enter fullscreen mode Exit fullscreen mode

shell is zsh

After running this command, webpack was forced to recompile everything and I no longer saw those pesky errors again.

Top comments (0)

This post blew up on DEV in 2020:

js visualized

πŸš€βš™οΈ JavaScript Visualized: the JavaScript Engine

As JavaScript devs, we usually don't have to deal with compilers ourselves. However, it's definitely good to know the basics of the JavaScript engine and see how it handles our human-friendly JS code, and turns it into something machines understand! πŸ₯³

Happy coding!

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay