Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webpack-dev-server can't detect file changes in nested folder

I'm using webpack-dev-server v1.14.1 for my project and the whole project structure is as follows:

|----src
|     |----index.js
|     |----components
|     |     |----a.js
|     |----containers
|           |----sub-containers
|                 |----b.js 
|     
|----package.json
|----webpack.config.dev.js

However, when I run command "webpack-dev-server --inline", the server can only catch changes in a.js file. It ignores changes in b.js file. Any thoughts?

like image 235
wei Avatar asked Jun 01 '26 17:06

wei


1 Answers

Problem solved! It was caused by wrong import in src/index.js file. I imported b.js wrong way:

import B from "./containers/sub-containers/B";

I capitalized the file name "b". However, webpack didn't complain about this and could resolve this import. It only made hot reloading for changes in b.js not work. After changing it to:

import B from "./containers/sub-containers/b"

it works now! :)

NOTE: I'm still curious about why webpack can resolve the wrong filename. Or is it case insensitive?

like image 183
wei Avatar answered Jun 03 '26 08:06

wei