You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constpath=require('path');constReactRefreshPlugin=require('@pmmmwh/react-refresh-webpack-plugin');constHtmlWebpackPlugin=require('html-webpack-plugin');constwebpack=require('webpack');// Current working directoryconstBASE_PATH=process.cwd();// Get path relative to current working directoryconstgetPath=_path=>path.join(BASE_PATH,_path);constisDevelopment=process.env.NODE_ENV!=='production';module.exports={mode: isDevelopment ? 'development' : 'production',entry: {main: [`${require.resolve('webpack-hot-middleware/client')}?path=http://localhost:3000/__webpack_hmr`,'./src/index.js'],},target: 'web',output: {filename: 'bundle.js',path: path.resolve(__dirname,'dist'),publicPath: '/',},devtool: 'cheap-module-source-map',module: {rules: [{test: /\.(j|t)sx?$/,include: modulePath=>{returnmodulePath.includes(getPath('..'))||modulePath.includes(getPath('./src'))},use: {loader: require.resolve('babel-loader'),options: {presets: [require.resolve('@babel/preset-react'),[require.resolve('@babel/preset-env'),{targets: "defaults"},],require.resolve('@babel/preset-typescript'),],plugins: [require.resolve('react-refresh/babel'),],}}}]},plugins: [newwebpack.HotModuleReplacementPlugin(),newReactRefreshPlugin({overlay: false,}),newHtmlWebpackPlugin({template: './index.html',}),],resolve: {alias: {'@project': getPath('..')},modules: ['node_modules',getPath('../../node_modules')],extensions: ['.js','.jsx','.ts','.tsx'],},};
I am using the above config from a cli script hence the use of cwd. The issue I am facing is whenever I make changes to module other than the currently compiled module, fast refreshing does not work. Following is the log from browser
client.js:95 [HMR] connected
client.js:250 [HMR] bundle rebuilt in 114ms
client.js:241 [HMR] bundle rebuilding
client.js:250 [HMR] bundle rebuilt in 208ms
process-update.js:51 [HMR] Checking for updates on the server...
process-update.js:125 [HMR] Updated modules:
process-update.js:127 [HMR] - ../library/lib.ts
process-update.js:132 [HMR] App is up to date.
client.js:250 [HMR] bundle rebuilt in 208ms
As can be seen above, the changes are detected but the components remain unchanged. The modules loaded from current working directory works as expected.
The text was updated successfully, but these errors were encountered:
Can you provide me a reproducible example? If you output the development Webpack bundle to disk, do you see the injected runtime code from this plugin in your monorepo imports? (It would be some react-refresh variables, etc.)
I have the following following webpack config
I am using the above config from a cli script hence the use of
cwd
. The issue I am facing is whenever I make changes to module other than the currently compiled module, fast refreshing does not work. Following is the log from browserAs can be seen above, the changes are detected but the components remain unchanged. The modules loaded from current working directory works as expected.
The text was updated successfully, but these errors were encountered: