Skip to content

Commit

Permalink
Don't double load postcss.config.js (#3018)
Browse files Browse the repository at this point in the history
* lazy load dep

* Don't double load postcss.config.js

postcss-loader already does this on its own. If we pass in a list it can cause duplicated plugins inside postcss-loader after it does it's de-duplication routines
  • Loading branch information
thecrypticace committed Jun 19, 2021
1 parent 8ce7cf6 commit 6fdf6db
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/PostCssPluginsFactory.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
let postcssrc = require('postcss-load-config');

class PostCssPluginsFactory {
/**
* Create a new instance.
Expand All @@ -17,19 +15,19 @@ class PostCssPluginsFactory {
* Load all relevant PostCSS plugins.
*/
load() {
this.loadConfigFile()
.loadGlobalPlugins()
.loadLocalPlugins()
.loadAutoprefixer()
.loadCssNano();
this.loadGlobalPlugins().loadLocalPlugins().loadAutoprefixer().loadCssNano();

return this.plugins;
}

/**
* Load the user's postcss.config.js file, if any.
*
* @deprecated postcss-loader already does this on its own
*/
loadConfigFile() {
let postcssrc = require('postcss-load-config');

try {
this.plugins = [...this.plugins, ...postcssrc.sync().plugins];
} catch (e) {
Expand Down

0 comments on commit 6fdf6db

Please sign in to comment.