Importing external CSS goes kaboom
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.
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.
@glennreyes sure that's a fine work around but it seems like it'd be nice to resolve CSS from node_modules as well. ¯(ツ)/¯
@glennreyes I think we can just remove that include line for .css. The reason we need that for .js is we don't want babel to transform stuff under node_modules, but for CSS files they should be processed by webpack anyway so it should be fine. Do you want to send a PR?
also cc @gaearon to double check. :)
@keyanzhang Sure 😉
Thanks @glennreyes!
@glennreyes @keyanzhang 🎉 Yey! Thanks!
Should be fixed in 0.2.0 alpha. Please help us test it! https://github.com/facebookincubator/create-react-app/pull/190
Tested in 0.2.0 alpha and this worked as expected. 🌞
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".