question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing external CSS goes kaboom

See original GitHub issue

When I installed hack and then tried importing it I get the following error. 💥💥💥

Error in ./~/hack/dist/hack.css
Module parse failed: /Users/tristanoneil/src/saute/node_modules/hack/dist/hack.css Unexpected token (1:4)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (1:4)
 @ ./src/index.js 11:0-15

Feel free to close if this just isn’t how create-react-app is intended to be used but I could see others being bit by this as well so hence the issue.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
glennreyescommented, Jul 22, 2016

The default config resolves CSS files only located in your src folder: https://github.com/facebookincubator/create-react-app/blob/master/config/webpack.config.dev.js#L70

You can solve this by ejecting the config and removing the line or put another loader for external CSS.

0reactions
gaearoncommented, Jul 29, 2016

FWIW alpha is now stable so newly created projects will just work with this, and old projects can be updated to "react-scripts": "0.2.0".

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I include css files using node, express, and ejs?
1.Create a new folder named 'public' if none exists. · 2.Create a new folder named 'css' under the newly created 'public' folder ·...
Read more >
import - CSS: Cascading Style Sheets - MDN Web Docs
The @import CSS at-rule is used to import style rules from other valid stylesheets. An @import rule must be defined at the top...
Read more >
External CSS Stylesheets – How to Link CSS to HTML and ...
It is considered a best practice to have your CSS stylesheets in an external file. So how can you link that CSS to...
Read more >
How to add CSS to Grafana - templating
I have been trying to add CSS to my CSS that looks like something like ... I can import from Boom plugin my...
Read more >
14 CSS Best Practices for Beginners - Kinsta
External CSS vs. Internal CSS; Minify Your Stylesheet; Use a Preprocessor; Consider a CSS Framework; Start with a Reset; Classes vs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found