I am working on a project using Webpack 4.10.2 and Material-UI v1.1.0. MUI docs is talking about class name generator, and I am OK with the result of shortening classes names, but there is something I don't understand in the build process, I am probably missing a Webpack Module or Plugin (I am for instance just using babel-loader and no Plugin). I just tryed many combinations with UglifyJsPlugin (through optimization.minimizer) compress and mangle but nothing works.
The problem:
The class names injected in the document style tags are shortened, but not the corresponding classes in the body:
Development mode
Everything is fine when build my project in Development mode, using webpack -d
:
<style type="text/css" data-jss="" data-meta="LayoutNavBar">
.LayoutNavBar-flex-4 {
flex: 1;
}
</style>
and in the body, the corresponding classes
<h2 class="LayoutNavBar-flex-4">Title</h2>
Production mode
Styles are broken when I build in Production mode, I have inline style with shortened class names (that's good):
<style type="text/css" data-jss="" data-meta="LayoutNavBar">
.jss4 {
flex: 1;
}
</style>
but in the body, CSS classes are still with their long names:
<h2 class="LayoutNavBar-flex-4">Title</h2>
instead of having:
<h2 class="jss4">Title</h2>
What am I missing to make it work ? Thanks