Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions streamlit_antd_components/frontend/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// NOTE: The following line needs to be the first import to ensure that we
// correctly configure where chunked static assets are fetched from.
import "./setWebpackPublicPath"

import {ComponentProps, withStreamlitConnection} from "streamlit-component-lib";
import "bootstrap-icons/font/bootstrap-icons.css";
import React from "react"
Expand Down
34 changes: 34 additions & 0 deletions streamlit_antd_components/frontend/src/setWebpackPublicPath.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// If __WEBPACK_PUBLIC_PATH_OVERRIDE is set, fetches of chunked static assets
// will have their request base paths set to this value. For example, if
// __WEBPACK_PUBLIC_PATH_OVERRIDE="https://example.com/", we'll attempt to
// fetch someJavascriptCode.chunk.js from https://example.com/someJavascriptCode.chunk.js
// Of course, we'll need to rework this if we ever decide to move away from
// webpack.
const webpackPublicPath: string | undefined = (window as any)
.__WEBPACK_PUBLIC_PATH_OVERRIDE

// eslint-disable-next-line @typescript-eslint/naming-convention
declare let __webpack_public_path__: string | undefined

if (webpackPublicPath) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__webpack_public_path__ = webpackPublicPath
}

export {}