Module parse failed React Origin: On your device Last updated 14 Oct 2026

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).

Exact message you may see Module parse failed: Unexpected tokenYou may need an appropriate loader to handle this file type
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

  1. Add a rule for the file type
  2. Include the package in babel-loader’s transpiled modules
  3. Upgrade the toolchain (or move to Vite)

Detailed fix by platform

React

  1. { test: /\.[jt]sx?$/, exclude: /node_modules/, use: 'babel-loader' }

How to diagnose

  1. File — Which file and token?
  2. Loader — Is there a rule for it?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Can't find stylesheet to import — Angular (Sass): Error: Can't find stylesheet to import. @import 'variables'; (Angular)Can't find stylesheet…Can't resolve 'fs' — Module not found: Can't resolve 'fs' (Next.js / webpack 5) (React)Can't resolve 'fs'ChunkLoadError — ChunkLoadError: Loading chunk 123 failed. (JavaScript)ChunkLoadErrorCOPY failed — COPY failed: file not found in build context / "/app/x": not found (Docker)COPY failedDevTools failed to load source map — DevTools: Failed to load source map — Could not load content for https://…/app.js.map: HTTP error: status code 404 (Browser)DevTools failed to lo…ERR_OSSL_EVP_UNSUPPORTED — Error: error:0308010C:digital envelope routines::unsupported (Node.js)ERR_OSSL_EVP_UNSUPPOR…Gradle wrapper main class — Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain (Java)Gradle wrapper main c…lookup registry-1.docker.io: no such host — dial tcp: lookup registry-1.docker.io: no such host / Temporary failure in name resolution during docker build (Docker)lookup registry-1.doc…Module pa…

Explore the map of this error Full error map →

🧠 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.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.