From d85934a85582c0d6e712170e1b6fc9e940fda78f Mon Sep 17 00:00:00 2001 From: Michael Kret <88898367+michael-radency@users.noreply.github.com> Date: Thu, 24 Feb 2022 18:17:24 +0200 Subject: [PATCH] :bug: Fix issue with running n8n under subfolder (#2816) --- packages/editor-ui/src/main.ts | 1 + packages/editor-ui/src/public_path.js | 2 ++ packages/editor-ui/vue.config.js | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 packages/editor-ui/src/public_path.js diff --git a/packages/editor-ui/src/main.ts b/packages/editor-ui/src/main.ts index 3772007855..bcd839bafb 100644 --- a/packages/editor-ui/src/main.ts +++ b/packages/editor-ui/src/main.ts @@ -1,5 +1,6 @@ // The Vue build version to load with the `import` command // (runtime-only or standalone) has been set in webpack.base.conf with an alias. +import './public_path'; import Vue from 'vue'; import './plugins'; diff --git a/packages/editor-ui/src/public_path.js b/packages/editor-ui/src/public_path.js new file mode 100644 index 0000000000..6c3ce6d7e0 --- /dev/null +++ b/packages/editor-ui/src/public_path.js @@ -0,0 +1,2 @@ +// setting webpack publickPath on the fly to fix MonacoWebpackPlugin errors +export default __webpack_public_path__ = window.BASE_PATH === '/%BASE_PATH%/' ? '/' : window.BASE_PATH; diff --git a/packages/editor-ui/vue.config.js b/packages/editor-ui/vue.config.js index 5f43c129b9..35338dd497 100644 --- a/packages/editor-ui/vue.config.js +++ b/packages/editor-ui/vue.config.js @@ -37,5 +37,5 @@ module.exports = { }, }, }, - publicPath: process.env.VUE_APP_PUBLIC_PATH && process.env.VUE_APP_PUBLIC_PATH !== '/%BASE_PATH%/' ? process.env.VUE_APP_PUBLIC_PATH : '/', + publicPath: process.env.VUE_APP_PUBLIC_PATH ? process.env.VUE_APP_PUBLIC_PATH : '/', };