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
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" },
]
}
};