Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Add webpack 4 compatibility #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default class IconfontPlugin {
}

this.options = Object.assign({}, options);
this.fileDependencies = [];
this.hashes = {};

this.compile = this.compile.bind(this);
Expand Down Expand Up @@ -85,8 +84,16 @@ export default class IconfontPlugin {

globPatterns.forEach(globPattern => {
const context = globParent(globPattern);
if (compilation.contextDependencies.indexOf(context) === -1) {
compilation.contextDependencies.push(context);
const contextDependencies = compilation.contextDependencies;

if (contextDependencies instanceof Set) {
if (!contextDependencies.has(context)) {
contextDependencies.add(context);
}
} else if (Array.isArray(contextDependencies)) {
if (contextDependencies.indexOf(context) === -1) {
contextDependencies.push(context);
}
}
});

Expand Down