Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You may need an appropriate loader to handle this file type #686

Closed
fahamidev opened this issue Mar 3, 2018 · 4 comments
Closed

You may need an appropriate loader to handle this file type #686

fahamidev opened this issue Mar 3, 2018 · 4 comments

Comments

@fahamidev
Copy link

fahamidev commented Mar 3, 2018

Hi.
I put my problem inside the stackoverflow .

and in summary :

I received the following error :

ERROR in ./public/testStyle.css
Module parse failed: /media/ehsan/news-ssr/public/testStyle.css Unexpected token (1:5)
You may need an appropriate loader to handle this file type.
| body {
|     background-color: red;
| }
 @ ./src/client/pages/HomeContainer.js 31:0-40
 @ ./src/client/Routes.js
 @ ./src/client/client.js

and css-loader config :

            {
                test: /\.css$/,
                include: /node_modules/,
                use: [
                    'style-loader',
                    {
                        loader: 'css-loader',
                        options: {modules: true, sourceMap: true}
                    }
                ]
            }

package versions :
"webpack": "^3.11.0" , "style-loader": "^0.18.2" , "css-loader": "^0.28.9"

Note that I have researched so much and I have not reached the result, so I thought I would ask here to answer it

Thank you for your advice.

@michael-ciniawsky
Copy link
Member

Remove the include as webpack will only apply the rule to CSS files within node_modules atm. node_modules will be included by default unless excluded explicitly via exclude

@fahamidev
Copy link
Author

that I removed the include: /node_modules/ and I did not leave anything. Or I gave it exclude: /node-modules/ instead. but I encountered an. ** ReferenceError: window is not defined.**

Is not this error related to css-loader?
Is this error related to nodeJS?
Where do I ask my question to be solved?

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Mar 3, 2018

Is not this error related to css-loader?

Seems unrelated

Is this error related to nodeJS?

Nope, it's a BuildError somewhere since you intend to run the code in the browser

Where do I ask my question to be solved?

StackOverflow (:label: webpack)
Gitter webpack/webpack

@fahamidev
Copy link
Author

@michael-ciniawsky I thank you very much for your guidance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants