Module parse failed: Unexpected token. You may need an appropriate loader to handle this file type
Webpack found syntax it can’t parse because no loader is configured for that file (JSX, TypeScript, CSS, or modern syntax in node_modules).
Seen on:
React
Meaning
Webpack needs loaders (babel-loader, ts-loader, css-loader). Packages shipping untranspiled modern syntax can also hit this in older webpack/babel setups.
Common causes
- Missing babel-loader/ts-loader rule
- JSX in .js files not covered by the rule
- CSS/images without loaders
- Dependency shipping newer syntax than your loader supports
⚡ Quick fix
- Add a rule for the file type
- Include the package in babel-loader’s transpiled modules
- Upgrade the toolchain (or move to Vite)
Detailed fix by platform
React
{ test: /\.[jt]sx?$/, exclude: /node_modules/, use: 'babel-loader' }
How to diagnose
- File — Which file and token?
- Loader — Is there a rule for it?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026