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
The project has a webpack config with multiple entry points. My development webpack file is below:
importReactRefreshWebpackPluginfrom'@pmmmwh/react-refresh-webpack-plugin';importwebpackfrom'webpack';// style files regexes// lifted from react-scripts webpack configconstcssRegex=/\.css$/;constcssModuleRegex=/\.module\.css$/;exportdefault{mode: 'development',devtool: 'eval-cheap-module-source-map',resolve: {alias: {'regenerator-runtime/runtime': 'regenerator-runtime/runtime.js',},},entry: {selfServeApp: ['webpack-hot-middleware/client',newURL('../../client/selfServeEntrypoint.js',import.meta.url).pathname,],adminApp: ['webpack-hot-middleware/client',newURL('../../client/adminAppEntrypoint.js',import.meta.url).pathname,],duoIframeLogin: ['webpack-hot-middleware/client',newURL('../../client/duoIframeLoginEntrypoint.js',import.meta.url).pathname,],duoIframeNagScreen: ['webpack-hot-middleware/client',newURL('../../client/duoIframeNagScreenEntrypoint.js',import.meta.url).pathname,],totpBypass: newURL('../../client/totpBypass/index.js',import.meta.url).pathname,totpNotRegistered: newURL('../../client/totpNotRegistered/index.js',import.meta.url).pathname,totpLockout: newURL('../../client/totpLockout/index.js',import.meta.url).pathname,},output: {filename: '[name].js',chunkFilename: '[name].js',path: newURL('../../public/assets',import.meta.url).pathname,publicPath: process.env.CLIENT_PUBLIC_PATH||'/assets/',},optimization: {nodeEnv: 'development',},module: {rules: [{oneOf: [{test: /\.(gif|png|jpe?g|svg)$/i,type: 'asset',},{test: /\.js$/,exclude: /node_modules/,use: {loader: 'babel-loader',options: {plugins: ['@babel/plugin-syntax-dynamic-import','react-refresh/babel',],presets: [['@babel/preset-react',{runtime: 'automatic',},],],},},},// mostly lifted from react-scripts webpack config, with production stuff removed{test: cssRegex,exclude: cssModuleRegex,use: ['style-loader',{loader: 'css-loader',options: {importLoaders: 1,sourceMap: false,// workaround for font data urls not working// https://github.com/webpack-contrib/css-loader/issues/1342#issuecomment-881587038url: {filter: (url)=>!url.startsWith('data:application/x-font-ttf'),},},},],// Don't consider CSS imports dead code even if the// containing package claims to have no side effects.// Remove this when webpack adds a warning or an error for this.// See https://github.com/webpack/webpack/issues/6571sideEffects: true,},// Adds support for CSS Modules (https://github.com/css-modules/css-modules)// using the extension .module.css{test: cssModuleRegex,use: ['style-loader',{loader: 'css-loader',options: {modules: {localIdentName: '[name]__[local]___[hash:base64:5]',},importLoaders: 1,// workaround for font data urls not working// https://github.com/webpack-contrib/css-loader/issues/1342#issuecomment-881587038url: {filter: (url)=>{return!url.startsWith('data:application/x-font-ttf');},},},},],},],},],},plugins: [newwebpack.HotModuleReplacementPlugin(),newReactRefreshWebpackPlugin({overlay: {sockIntegration: 'whm',},}),],experiments: {topLevelAwait: true,},};
I'm using Express to serve the app and webpack-dev-middleware in development to build and serve the development webpack bundles. Relevant Express setup for webpack-dev-middleware:
importwebpackfrom'webpack';importWebpackDevMiddlewarefrom'webpack-dev-middleware';importWebpackHotMiddlewarefrom'webpack-hot-middleware';importwebpackDevConfigfrom'../webpack/development/index.js';// if not in production mode, pull in development-specific configif(!isProduction){constcompiler=webpack(webpackDevConfig);app.use(WebpackDevMiddleware(compiler,{publicPath: webpackDevConfig.output.publicPath,stats: 'normal',}));app.use(WebpackHotMiddleware(compiler));app.set('compiler',compiler);}
This setup works in the selfServeApp and adminApp entrypoints, but not in the duoIframeLogin and duoIframeNagScreen entrypoints. In either of those, making a change to a React component causes webpack to build, but the browser does not update; I get warnings in the console about unaccepted updates:
webpack-dev-middleware output:
Console after webpack builds:
The entrypoints where hot refresh is working are far more complex than the ones where it isn't. The ones where is doesn't work are being loaded in iFrames, but hot refresh doesn't work when I load them standalone either, so I don't think the frame is the problem.
This is the entrypoint for one of the non-working bundles:
Bit of a weird issue here: I have a project using the following:
The project has a webpack config with multiple
entry
points. My development webpack file is below:I'm using Express to serve the app and webpack-dev-middleware in development to build and serve the development webpack bundles. Relevant Express setup for webpack-dev-middleware:
This setup works in the
selfServeApp
andadminApp
entrypoints, but not in theduoIframeLogin
andduoIframeNagScreen
entrypoints. In either of those, making a change to a React component causes webpack to build, but the browser does not update; I get warnings in the console about unaccepted updates:webpack-dev-middleware output:
Console after webpack builds:
The entrypoints where hot refresh is working are far more complex than the ones where it isn't. The ones where is doesn't work are being loaded in iFrames, but hot refresh doesn't work when I load them standalone either, so I don't think the frame is the problem.
This is the entrypoint for one of the non-working bundles:
Nothing special going on.
I'm stumped, and not sure where to begin trying to understand why it's working in some but not all bundles. Any pointers would be appreciated!
The text was updated successfully, but these errors were encountered: