cesarandreu / web-app

Reasonable starting point for building a web app
MIT License
308 stars 23 forks source link

css-loader issue, couldn't bundle project #18

Open mr-wildcard opened 9 years ago

mr-wildcard commented 9 years ago

Hi !

Windows 7 nodejs 0.12.7

I had trouble bundling this project (without any modification from my part, just a simple clone):

$ npm run dev

ERROR in ./app/styles.css
Module parse failed: D:\tests\react-web-app\app\styles.css Line 1: Unexpected token :
You may need an appropriate loader to handle this file type.
| :global *,
| :global *:after,
| :global *:before {
 @ ./app/index.js 11:17-40

ERROR in ./~/normalize.css/normalize.css
Module parse failed: D:\tests\react-web-app\node_modules\normalize.css\normalize.css Line 9: Unexpected token {
You may need an appropriate loader to handle this file type.
|  */
|
| html {
|   font-family: sans-serif; /* 1 */
|   -ms-text-size-adjust: 100%; /* 2 */
 @ ./app/index.js 9:0-24

ERROR in ./app/components/Hello/Hello.css
Module parse failed: D:\tests\react-web-app\app\components\Hello\Hello.css Line 1: Unexpected token .
You may need an appropriate loader to handle this file type.
| .greeting {
|   color: #00F;
| }
 @ ./app/components/Hello/Hello.js 29:16-38

I took a look at webpack.make output and found out that include values inside loaders were mixing slashes and backslashes:

{ test: /\.css$/,
    __include: 'D:\\tests\\react-web-app/app'__,
    loader: 'D:\\tests\\react-web-app\\node_modules\\extract-text-webpack-plugin\\loader.js?{"omit":1,"extract":true,"remove":true}!style!css?modules&sourceMap&localIdentName=[path][name]---[local]---[hash:base64:5]!postcss' },
  { test: /\.css$/,
    __include: 'D:\\tests\\react-web-app/node_modules'__,
    loader: 'D:\\tests\\react-web-app\\node_modules\\extract-text-webpack-plugin\\loader.js?{"omit":1,"extract":true,"remove":true}!style!css?sourceMap!postcss' } ]

Using path.normalize() on them fixed the issue. Do you want a PR ? I may need to apply this fix on every path concatenations.. What do you think ? :)

Cheers.

systembugtj commented 8 years ago

Send a pull request #20 could fix this issue.