You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And it's a common, widely present situation in projects depending on CRA. Because whoever ported CRA's configuration to Webpack 2 didn't notice that .extract() method from ExtractTextPlugin returns an array. And so this array still being passed under loader key.
As result postcss-loader cannot be found with getLoader utility method of react-app-rewired in production configuration.
One way to match with webpack's logic is to depend on Webpack's very own internal method RuleSet#normalizeRules and, well, normalize rule set before performing the search. But this has two obvious downsides:
It's an internal API and may change in the future
It will throw errors if invalid configuration object will be provided
The text was updated successfully, but these errors were encountered:
Why?
rule.loaders
From documentation:
rule.loader
For starters, it's still supported by webpack despite what documentation says.
And it's a common, widely present situation in projects depending on CRA. Because whoever ported CRA's configuration to Webpack 2 didn't notice that
.extract()
method fromExtractTextPlugin
returns an array. And so this array still being passed underloader
key.As result
postcss-loader
cannot be found withgetLoader
utility method ofreact-app-rewired
in production configuration.One way to match with webpack's logic is to depend on Webpack's very own internal method
RuleSet#normalizeRules
and, well, normalize rule set before performing the search. But this has two obvious downsides:The text was updated successfully, but these errors were encountered: