-
-
Notifications
You must be signed in to change notification settings - Fork 388
Description
I'm having the following issue:
In dev mode I have the following style order:

and in production it is like this:

Note different font-size applied to the element because of different CSS specificity (files load order) in these cases.
.c101__sidebarLink comes from react component that renders this element, and .plain-link, .contentful a is from common.scss that is imported in root component for the whole app.
My first assumption was that style-loader and mini-css-extract-plugin work differently because I'm using this config from the docs:
{
loader:
options.mode === 'development'
? 'style-loader'
: MiniCssExtractPlugin.loader,
},
But when I removed style-loader and left only mini-css-extract-plugin for both environments (just for testing purposes), the issue persisted. Then I used style-loader for both envs and the issue was gone. Also I didn't have this issue with webpack 3 and extract-text-webpack-plugin for prod env.
So my conclusion is that the issue is in mini-css-extract-plugin. For some reason it doesn't persist order of loaded CSS files in different environments. I'm not sure if it is related to #130 because I don't have multiple entry points.