Skip to content

Commit

Permalink
fix: Try to load plugin from webpack 5 first
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Nov 6, 2021
1 parent 4d4bbf0 commit 2256754
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/plugins/CachePluginFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

let CachePlugin;
try {
// webpack 4
CachePlugin = require("webpack/lib/CachePlugin");
} catch (e) {
// webpack 5
// eslint-disable-next-line import/no-unresolved
CachePlugin = require("webpack/lib/cache/MemoryCachePlugin");
} catch (e) {
// webpack 4
// eslint-disable-next-line import/no-unresolved,import/extensions
CachePlugin = require("webpack/lib/CachePlugin");
}

class CachePluginFactory {
Expand Down

0 comments on commit 2256754

Please sign in to comment.