fix: исправить загрузку статических файлов в продакшене

- Убран outputFileTracingRoot из next.config.js для корректной работы standalone режима
- В install.sh добавлено удаление старых файлов перед копированием новых
- Статические файлы (.next/static) и public теперь копируются корректно

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
kilyabin
2026-03-05 14:04:43 +04:00
parent 8122a3fa91
commit fa7fd147f5
2 changed files with 3 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ const nextConfig = {
output: 'standalone',
generateEtags: false,
allowedDevOrigins: ['192.168.1.10'],
// Не используем outputFileTracingRoot для корректной работы standalone режима
webpack: (config, { isServer }) => {
// Исключаем fs и path из клиентской сборки
if (!isServer) {

View File

@@ -242,11 +242,13 @@ if [ -d "$INSTALL_DIR/.next/standalone" ]; then
# Copy public directory to standalone (always update)
if [ -d "$INSTALL_DIR/public" ]; then
echo -e "${YELLOW}Copying public directory to standalone...${NC}"
rm -rf "$INSTALL_DIR/.next/standalone/public" 2>/dev/null || true
cp -r "$INSTALL_DIR/public" "$INSTALL_DIR/.next/standalone/public" 2>/dev/null || true
fi
# Copy .next/static to standalone/.next/static (always update)
if [ -d "$INSTALL_DIR/.next/static" ]; then
echo -e "${YELLOW}Copying .next/static to standalone...${NC}"
rm -rf "$INSTALL_DIR/.next/standalone/.next/static" 2>/dev/null || true
mkdir -p "$INSTALL_DIR/.next/standalone/.next"
cp -r "$INSTALL_DIR/.next/static" "$INSTALL_DIR/.next/standalone/.next/static" 2>/dev/null || true
else