You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React项目出现index.jsx.js 404错误,求排查方案

Troubleshooting the index.jsx.js 404 Error in Your React + Webpack App

Hey there, let's work through this confusing 404 issue together—that extra .js suffix on your filename is definitely odd, but we can track it down. Here are the most common places to investigate:

  • Double-check your Webpack entry configuration
    Pop open your webpack.config.js and look at the entry field. It’s easy to accidentally add an extra .js suffix here, like writing ./app/index.jsx.js instead of ./app/index.jsx. Also, check the resolve.extensions array—if it’s set to something like ['.js', '.jsx'], make sure you aren’t forcing an unnecessary suffix in your entry path (Webpack should automatically resolve the correct extension based on this list).

  • Inspect your HTML’s script tag
    If you’re manually adding a script tag in your index.html to load the bundle, verify the src attribute. A typo here (like <script src="/app/index.jsx.js"></script>) would directly cause this 404. If you’re using html-webpack-plugin, check its configuration to ensure it’s not generating an incorrect script path.

  • Search for accidental index.jsx.js references
    Do a full project search for the string index.jsx.js—it’s possible you made a typo in an import statement somewhere (e.g., import Component from './index.jsx.js'). Even one misplaced reference could trigger Webpack to try resolving this non-existent file.

  • Review Webpack’s output settings
    Look at the output section in your config. If the filename property is set to something like [name].jsx.js, that would cause Webpack to generate a bundle with the double suffix. Also, check the publicPath value—an incorrect public path might be appending extra segments to your file URL.

  • Check DevServer configuration
    If you’re using webpack-dev-server, verify the static (or contentBase in older versions) setting. A misconfigured static directory could lead the server to look for files in the wrong location. Also, rule out any proxy rules that might be redirecting requests incorrectly.

  • Clear cache and restart your dev server
    Sometimes Webpack’s cached build artifacts can cause weird, inconsistent issues. Try deleting the node_modules/.cache directory, stopping your dev server, and restarting it with a fresh build.

内容的提问来源于stack exchange,提问作者RockDev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 07:50:57