mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
fix(core): fix hooks URLs no longer added to index.html
(#4262)
🐛 Fix hooks URLs no longer added to `index.html`
This commit is contained in:
parent
e30c78febe
commit
cc2a2e438b
|
@ -1789,16 +1789,16 @@ class App {
|
|||
const editorUiDistDir = pathJoin(pathDirname(require.resolve('n8n-editor-ui')), 'dist');
|
||||
const generatedStaticDir = pathJoin(__dirname, '../public');
|
||||
|
||||
const firstLinkedScriptSegment = '<link href="/js/';
|
||||
const closingTitleTag = '</title>';
|
||||
const compileFile = async (fileName: string) => {
|
||||
const filePath = pathJoin(editorUiDistDir, fileName);
|
||||
if (/(index.html)|.*\.(js|css)/.test(filePath) && existsSync(filePath)) {
|
||||
if (/(index\.html)|.*\.(js|css)/.test(filePath) && existsSync(filePath)) {
|
||||
const srcFile = await readFile(filePath, 'utf8');
|
||||
let payload = srcFile.replace(basePathRegEx, n8nPath);
|
||||
if (filePath === 'index.html') {
|
||||
if (filePath.endsWith('index.html')) {
|
||||
payload = payload
|
||||
.replace(/\/favicon.ico/g, `${n8nPath}favicon.ico`)
|
||||
.replace(firstLinkedScriptSegment, scriptsString + firstLinkedScriptSegment);
|
||||
.replace(/\/favicon\.ico/g, `${n8nPath}favicon.ico`)
|
||||
.replace(closingTitleTag, closingTitleTag + scriptsString);
|
||||
}
|
||||
const destFile = pathJoin(generatedStaticDir, fileName);
|
||||
await mkdir(pathDirname(destFile), { recursive: true });
|
||||
|
|
Loading…
Reference in a new issue