mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(editor): fix BASE_PATH
for Vite dev mode (#4342)
* 🐛 Fix `BASE_PATH` for Vite dev mode
* don't use the string `/{{BASE_PATH}}/` as it gets replaces in build
* fix the static urls on windows
* ffs node 14
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
parent
32fb298e82
commit
24288a554d
|
@ -1800,7 +1800,7 @@ class App {
|
|||
const srcFile = await readFile(filePath, 'utf8');
|
||||
let payload = srcFile
|
||||
.replace(basePathRegEx, n8nPath)
|
||||
.replace(/\/static\//g, pathJoin(n8nPath, 'static/'));
|
||||
.replace(/\/static\//g, n8nPath + 'static/');
|
||||
if (filePath.endsWith('index.html')) {
|
||||
payload = payload.replace(closingTitleTag, closingTitleTag + scriptsString);
|
||||
}
|
||||
|
|
|
@ -55,8 +55,7 @@ function getTemplatesRedirect(store: Store<IRootState>) {
|
|||
|
||||
const router = new Router({
|
||||
mode: 'history',
|
||||
// @ts-ignore
|
||||
base: window.BASE_PATH ?? '/',
|
||||
base: import.meta.env.DEV ? '/' : window.BASE_PATH ?? '/',
|
||||
scrollBehavior(to, from, savedPosition) {
|
||||
// saved position == null means the page is NOT visited from history (back button)
|
||||
if (savedPosition === null && to.name === VIEWS.TEMPLATES && to.meta) {
|
||||
|
|
4
packages/editor-ui/src/shims.d.ts
vendored
4
packages/editor-ui/src/shims.d.ts
vendored
|
@ -5,6 +5,10 @@ declare module 'markdown-it-emoji';
|
|||
declare module 'markdown-it-task-lists';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
BASE_PATH: string;
|
||||
}
|
||||
|
||||
namespace JSX {
|
||||
// tslint:disable no-empty-interface
|
||||
interface Element extends VNode {}
|
||||
|
|
Loading…
Reference in a new issue