DEV Community


Posted on • Updated on

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.

Discussion (0)