0

I'm using Webpack in my project.

webpack.config.js:

moule.exports ={
...
module:{
rules:[
{
test:/\.css$/,
use:[
{loader:"css-loader"}
{loader:"style-loader"}
]
}
...
]}

Everything except this works fine:

css:

pre[class*="language-"]{
background:#f5f2f0
}

error:

Module parse failed:Unexpected token (7:10)
You may need appropriate loader to handle this file type, currently no loaders are configured to process this file. see https://webpack.js.org/concepts#loaders 
*/
> pre[class*="language-"] {
background:#f5f2f0

can someone tell me what should I add in my webpack.config.js file to help the css file run?

1 Answer 1

1

change the use array in your webpack.config.js file to

use: [
  "style-loader",
  "css-loader",
  "postcss-loader",
  },
]

Add a postcss.config file to your root folder with this content

module.exports = {
    plugins: [require("precss"), require("autoprefixer")],
};

Specifically in this order.

You can read more about postcss-loader here: https://webpack.js.org/loaders/postcss-loader/ Also, ensure you install these new loaders.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for your reply, but I don't know what plugins I have to put on Options at postcss.config.file. using that loader without putting value in Options - do nothing
I updated my comment to include your need to add a postcss.config file. There is more about this on the documentation.
i followed your instructions and also looked at postcss documintation for other ideas but I'm still getting the same error message

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.