fix: Rename chat.css to style.css in chat package build (#16622) (no-changelog)

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
Mutasem Aldmour
2025-06-23 12:20:04 +02:00
committed by GitHub
parent ef28d25ba2
commit 3c195dd42e
2 changed files with 17 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import { defineConfig, mergeConfig } from 'vite';
import { resolve } from 'path';
import { renameSync } from 'fs';
import vue from '@vitejs/plugin-vue';
import icons from 'unplugin-icons/vite';
import dts from 'vite-plugin-dts';
@@ -18,6 +19,21 @@ export default mergeConfig(
autoInstall: true,
}),
dts(),
{
name: 'rename-css-file',
closeBundle() {
// The chat.css is automatically named based on vite.config.ts library name.
// ChatTrigger Node requires https://cdn.jsdelivr.net/npm/@n8n/chat/dist/style.css
// As such for backwards compatibility, we need to maintain the same name file
const cssPath = resolve(__dirname, 'dist', 'chat.css');
const newCssPath = resolve(__dirname, 'dist', 'style.css');
try {
renameSync(cssPath, newCssPath);
} catch (error) {
console.error('Failed to rename chat.css file:', error);
}
},
},
],
resolve: {
alias: {