From cf967a306b010a02e7f0ad6681a2ceffe47a2911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Bertrand?= Date: Sun, 1 Aug 2021 05:47:47 +0200 Subject: [PATCH] fix svgo --- svgo.config.js | 10 ++++++++++ webpack.config.js | 12 ++---------- 2 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 svgo.config.js diff --git a/svgo.config.js b/svgo.config.js new file mode 100644 index 00000000..c665de03 --- /dev/null +++ b/svgo.config.js @@ -0,0 +1,10 @@ +module.exports = { + plugins: [ + { + name: 'inlineStyles', + params: { + onlyMatchedOnce: false + } + } + ] +} diff --git a/webpack.config.js b/webpack.config.js index df4df3ce..45cf302c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,21 +2,13 @@ var path = require('path') const CopyPlugin = require('copy-webpack-plugin') const webpack = require('webpack') const fs = require('fs') -const SvgoInstance = require('svgo') +const { optimize } = require('svgo'); const entry = require('./package.json').main const readManifest = () => JSON.parse(fs.readFileSync(path.join(__dirname, './manifest.konnector'))) -const svgo = new SvgoInstance({ - plugins: [ - { - inlineStyles: { onlyMatchedOnce: false } - } - ] -}) - let iconName try { iconName = JSON.parse(fs.readFileSync('manifest.konnector', 'utf8')).icon @@ -61,7 +53,7 @@ module.exports = { function optimizeSVGIcon(buffer, path) { if (appIconRX && path.match(appIconRX)) { - return svgo.optimize(buffer).then(resp => resp.data) + return optimize(buffer).then(resp => resp.data) } else { return buffer }