1

Is there a way to compile css modules in a webpack build but not compile the javascript at all? I want to publish a react component that uses css-modules, but point to my source files as the entry point (un-transpiled javascript). However, if I don't compile the css-modules, the people that consume that component won't be able to use it unless they are also using css-modules loaders. Is something like this even possible in webpack, or is there some library which exists that does this?

1 Answer 1

1

I believe you can utilize the null-loader for your JavaScript. The loader portion of your config should look something like this.

{
    module: {
        loaders: [
            { test: /\.js$/, loader: "null-loader" },
            { test: /\.css$/, loader: "style-loader!css-loader" },
        ]

    }
};
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.