I'm running into an issue that I've never experienced before with Webpack. Simply put - I am having webpack watch my react files and compile it into a bundle by webpack --watch
. The initial compile and build works great as seen and I am able to see the changes. However, making any additional changes does not build the bundle with the update changes for some reason. You can see it here in the output of webpack running
webpack 5.37.0 compiled successfully in 1243 ms
assets by status 1.14 MiB [cached] 1 asset
cached modules 1.07 MiB (javascript) 1.13 KiB (runtime) [cached] 39 modules
./public/src/components/home/components/HeaderInformation.jsx 608 bytes [built]
webpack 5.37.0 compiled successfully in 27 ms
assets by status 1.14 MiB [cached] 1 asset
cached modules 1.07 MiB (javascript) 1.13 KiB (runtime) [cached] 40 modules
webpack 5.37.0 compiled successfully in 19 ms
assets by status 1.14 MiB [cached] 1 asset
cached modules 1.07 MiB (javascript) 1.13 KiB (runtime) [cached] 40 modules
webpack 5.37.0 compiled successfully in 18 ms
The only workaround I've found so far is to restart webpack and tell it to watch again... Not ideal. I have no clue what I'm missing here as I'm not seeing any errors, and my search on the web has led me to no answers. For context, this is my webpack.config file
module.exports = {
entry: __dirname + '/public/src/index.jsx',
mode: 'development',
module: {
rules: [
{
test: [/\.jsx$/],
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-react', '@babel/preset-env']
}
}
}
]
},
output: {
filename: 'bundle.js',
path: __dirname + '/public/dist'
}
};