(server: ViteDevServer)
| 34 | return { |
| 35 | name: 'chrome129IssuePlugin', |
| 36 | configureServer(server: ViteDevServer) { |
| 37 | server.middlewares.use((req, res, next) => { |
| 38 | const raw = req.headers['user-agent']?.match(/Chrom(e|ium)\/([0-9]+)\./); |
| 39 | |
| 40 | if (raw) { |
| 41 | const version = parseInt(raw[2], 10); |
| 42 | |
| 43 | if (version === 129) { |
| 44 | res.setHeader('content-type', 'text/html'); |
| 45 | res.end( |
| 46 | '<body><h1>Please use Chrome Canary for testing.</h1><p>Chrome 129 has an issue with JavaScript modules & Vite local development, see <a href="https://github.com/stackblitz/bolt.new/issues/86#issuecomment-2395519258">for more information.</a></p><p><b>Note:</b> This only impacts <u>local development</u>. `pnpm run build` and `pnpm run start` will work fine in this browser.</p></body>', |
| 47 | ); |
| 48 | |
| 49 | return; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | next(); |
| 54 | }); |
| 55 | }, |
| 56 | }; |
| 57 | } |
nothing calls this directly
no outgoing calls
no test coverage detected