From b770d3cb6c572ec313f16e44dcba9d2ef1cc92b6 Mon Sep 17 00:00:00 2001 From: Amir Zarrinkafsh Date: Wed, 24 Jun 2020 09:37:49 +1000 Subject: [PATCH] [BUGFIX] Fix paths for embedded media assets (#1150) --- web/src/hooks/AssetPath.ts | 7 +++++++ web/src/index.tsx | 1 + web/src/react-app-env.d.ts | 1 + 3 files changed, 9 insertions(+) create mode 100644 web/src/hooks/AssetPath.ts diff --git a/web/src/hooks/AssetPath.ts b/web/src/hooks/AssetPath.ts new file mode 100644 index 00000000..2ac45d9e --- /dev/null +++ b/web/src/hooks/AssetPath.ts @@ -0,0 +1,7 @@ +import { useBasePath } from "./BasePath"; + +__webpack_public_path__ = "/" + +if (useBasePath() !== "") { + __webpack_public_path__ = useBasePath() + "/" +} \ No newline at end of file diff --git a/web/src/index.tsx b/web/src/index.tsx index 87d1be55..f4f0819b 100644 --- a/web/src/index.tsx +++ b/web/src/index.tsx @@ -1,3 +1,4 @@ +import './hooks/AssetPath'; import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; diff --git a/web/src/react-app-env.d.ts b/web/src/react-app-env.d.ts index 6431bc5f..ab49f1b5 100644 --- a/web/src/react-app-env.d.ts +++ b/web/src/react-app-env.d.ts @@ -1 +1,2 @@ /// +declare var __webpack_public_path__: string; \ No newline at end of file