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