diff --git a/src/index.js b/src/index.js index 30627eb..e1d5994 100644 --- a/src/index.js +++ b/src/index.js @@ -607,15 +607,15 @@ class TerserPlugin { const querySplit = filename.indexOf("?"); if (querySplit >= 0) { - query = filename.substr(querySplit); - filename = filename.substr(0, querySplit); + query = filename.slice(querySplit); + filename = filename.slice(0, querySplit); } const lastSlashIndex = filename.lastIndexOf("/"); const basename = lastSlashIndex === -1 ? filename - : filename.substr(lastSlashIndex + 1); + : filename.slice(lastSlashIndex + 1); const data = { filename, basename, query }; output.commentsFilename = compilation.getPath( diff --git a/test/helpers/readAsset.js b/test/helpers/readAsset.js index fde3ff3..bd1ae27 100644 --- a/test/helpers/readAsset.js +++ b/test/helpers/readAsset.js @@ -10,7 +10,7 @@ export default (asset, compiler, stats) => { const queryStringIdx = targetFile.indexOf("?"); if (queryStringIdx >= 0) { - targetFile = targetFile.substr(0, queryStringIdx); + targetFile = targetFile.slice(0, queryStringIdx); } try {