From 5d275983b89b0e78cebd4c41e2bfe5d9deb8f73e Mon Sep 17 00:00:00 2001 From: Damian Stasik Date: Sat, 29 Aug 2020 12:51:51 +0200 Subject: [PATCH] Reduce memory footprint by importing specific function from `semver` package --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 2143269..63264da 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ const SVGO = require('svgo'); const { getOptions } = require('loader-utils'); const { version } = require('vue'); -const { major } = require('semver') +const semverMajor = require('semver/functions/major') module.exports = async function (svg) { const callback = this.async(); @@ -20,7 +20,7 @@ module.exports = async function (svg) { } } - if (major(version) === 2) { + if (semverMajor(version) === 2) { svg = svg.replace('