From d35506112bf2389855ae4b672e9ac26ed3f3aa31 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Fri, 9 Jul 2021 12:31:16 +0200 Subject: [PATCH] Add svg support --- Dashboard/assets/assets.d.ts | 4 ++++ Dashboard/package.json | 1 + Dashboard/tsconfig.json | 2 +- Dashboard/webpack.config.js | 11 +++++++++-- Dashboard/yarn.lock | 8 ++++++++ 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 Dashboard/assets/assets.d.ts diff --git a/Dashboard/assets/assets.d.ts b/Dashboard/assets/assets.d.ts new file mode 100644 index 0000000..1a3dd3c --- /dev/null +++ b/Dashboard/assets/assets.d.ts @@ -0,0 +1,4 @@ +declare module "*.svg" { + const content: any; + export default content; +} diff --git a/Dashboard/package.json b/Dashboard/package.json index 3ea5201..9d6be73 100644 --- a/Dashboard/package.json +++ b/Dashboard/package.json @@ -84,6 +84,7 @@ "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-react": "^7.24.0", "eslint-plugin-react-hooks": "^4.2.0", + "file-loader": "^6.2.0", "fork-ts-checker-webpack-plugin": "^6.2.12", "html-webpack-plugin": "^4.3.0", "style-loader": "^1.2.1", diff --git a/Dashboard/tsconfig.json b/Dashboard/tsconfig.json index 95a5efc..d85cc6c 100644 --- a/Dashboard/tsconfig.json +++ b/Dashboard/tsconfig.json @@ -22,6 +22,6 @@ "resolveJsonModule": true, "allowJs": true }, - "include": ["src"], + "include": ["src", "assets/assets.d.ts"], "exclude": ["src/electron.js"] } diff --git a/Dashboard/webpack.config.js b/Dashboard/webpack.config.js index c076c70..c8cc876 100644 --- a/Dashboard/webpack.config.js +++ b/Dashboard/webpack.config.js @@ -45,8 +45,15 @@ module.exports = (env, argv) => { use: ["style-loader", "css-loader"], }, { - test: /\.(jpg|jpeg|png|gif|mp3|svg)$/, - use: ["file-loader"], + test: /\.(png|jp(e*)g|svg|gif)$/, + use: [ + { + loader: "file-loader", + options: { + name: "assets/[hash]-[name].[ext]", + }, + }, + ], }, ], }, diff --git a/Dashboard/yarn.lock b/Dashboard/yarn.lock index 92911b4..a70c940 100644 --- a/Dashboard/yarn.lock +++ b/Dashboard/yarn.lock @@ -3758,6 +3758,14 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" +file-loader@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-6.2.0.tgz#baef7cf8e1840df325e4390b4484879480eebe4d" + integrity sha512-qo3glqyTa61Ytg4u73GultjHGjdRyig3tG6lPtyX/jOEJvHif9uB0/OCI2Kif6ctF3caQTW2G5gym21oAsI4pw== + dependencies: + loader-utils "^2.0.0" + schema-utils "^3.0.0" + file-uri-to-path@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"