0

I am using webpack and I need to include some libraries built for requirejs. Everything worked fine until one of the library declared a css dependency:

define(["css!./stylesheet.css"], function(){ \* module *\ });

Webpack has a css loader too, however it does not load them automatically as requirejs's one does. One must pipe the css loader to the style loader to do so:

require("style!css!./stylesheet.css");

Is there any way to make the prior working? For example, can I overwrite the css loader for this particular library so that it is piped with the style loader ?

1 Answer 1

2

I found a nice solution using postLoaders.

Adding

postLoaders: [
  { test: /\.css$/, loader: 'style', include: path.join(__dirname, "pathTo/theLib") }
]

into the module property of the webpack config did the trick.

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

Comments

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.