#StackBounty: #reactjs #webpack #create-react-app Create-react-app 'Failed to compile.' due to css import

Bounty: 50

Appearing out of nowhere, this error has me stomped. It appears any time I try to import a css file, whether in full or as a module.


import "./index.css"


import styles from "./button.module.css"

It MAY have been due to the latest macOS beta at least it seems to have coincided with its release. I tried rolling back from it, but that didn’t work.

Failed to compile
./src/index.css (./node_modules/css-loader/dist/cjs.js?modules=true!./node_modules/style-loader/dist/cjs.js!./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-4-1!./node_modules/postcss-loader/src??postcss!./src/index.css)
CssSyntax error: Unknown word (1:1)

> 1 | var api = require("!../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js");
    | ^
  2 |             var content = require("!!../node_modules/css-loader/dist/cjs.js??ref--6-oneOf-4-1!../node_modules/postcss-loader/src/index.js??postcss!./index.css");
  3 | 
This error occurred during the build time and cannot be dismissed.

I’ve tried manually adding web pack, checked everything for syntax errors, re-installed the whole repo, went back several commits and so on. Nothing seems to do anything. Happy to supply more context.

(I found one other person mentioning the same problem on SO 15 hours ago, but he hadn’t supplied debugging information so the ticket was closed).

Note: The same codebase runs perfectly well on my MacBook, no problems!

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.