From 3c195dd42e080370c9963948e7678144a9655d94 Mon Sep 17 00:00:00 2001
From: Mutasem Aldmour <4711238+mutdmour@users.noreply.github.com>
Date: Mon, 23 Jun 2025 12:20:04 +0200
Subject: [PATCH] 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>
---
.../nodes/trigger/ChatTrigger/README.md | 2 +-
packages/frontend/@n8n/chat/vite.config.mts | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/README.md b/packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/README.md
index e81821e12d0..3bb36b44fae 100644
--- a/packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/README.md
+++ b/packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/README.md
@@ -50,5 +50,5 @@ Modify the import paths in `templates.ts` to point to your local server:
```
```html
-
+
```
diff --git a/packages/frontend/@n8n/chat/vite.config.mts b/packages/frontend/@n8n/chat/vite.config.mts
index e009419f5ee..75abffe6bf8 100644
--- a/packages/frontend/@n8n/chat/vite.config.mts
+++ b/packages/frontend/@n8n/chat/vite.config.mts
@@ -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: {