Skip to content

Commit

Permalink
fix: base_path in development is a string
Browse files Browse the repository at this point in the history
  • Loading branch information
zumuta committed Nov 26, 2024
1 parent 211098b commit 7d7197c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backend/src/kwai/frontend/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __call__(self, settings: Annotated[Settings, Depends(get_settings)]) -> Vite
status_code=status.HTTP_400_BAD_REQUEST,
detail=f"Setting base_dev not set for application {self._application_name}",
)
return DevelopmentVite(Path(app_setting.base_dev))
return DevelopmentVite(app_setting.base_dev)

manifest_path = (
Path(settings.frontend.path)
Expand Down
17 changes: 14 additions & 3 deletions backend/src/kwai/frontend/vite.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,18 @@ def get_asset_path(self, asset_path: Path) -> Path | None:
class DevelopmentVite(Vite):
"""Vite implementation for development."""

def __init__(self, base_path: Path):
def __init__(self, base_path: str):
"""Initialize the development version of vite.
Args:
base_path: The base path for the development version of vite.
!!! Note
When vite is configured with a base then make sure that this
base is also part of the base_path argument. For example: when base is
'/apps/author' and the server is running on localhost with port 3001, then
base_path should be: 'http://localhost:3001/apps/author'.
"""
self._base_path = base_path
self._entries: list[str] = []

Expand Down Expand Up @@ -81,8 +92,8 @@ def __init__(self, manifest_filepath: Path, base_path: Path):
"""Initialize the production Vite runtime.
Args:
manifest_filepath (Path): Path to the manifest file.
base_path (Path): Path to the dist folder.
manifest_filepath: Path to the manifest file.
base_path: Path to the dist folder.
"""
self._manifest_filepath: Path = manifest_filepath
self._base_path: Path = base_path
Expand Down

0 comments on commit 7d7197c

Please sign in to comment.