mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-07 22:49:26 +08:00
fix: ensure URL paths start with process.env.APP_PUBLIC_PATH
This commit is contained in:
parent
7e5dedae45
commit
736aa9ee93
@ -20,12 +20,11 @@ export default defineConfig({
|
|||||||
metas: [{ name: 'viewport', content: 'initial-scale=0.1' }],
|
metas: [{ name: 'viewport', content: 'initial-scale=0.1' }],
|
||||||
links: [{ rel: 'stylesheet', href: `${appPublicPath}global.css` }],
|
links: [{ rel: 'stylesheet', href: `${appPublicPath}global.css` }],
|
||||||
headScripts: [
|
headScripts: [
|
||||||
{
|
|
||||||
src: `${appPublicPath}browser-checker.js`,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
content: isDevCmd
|
content: isDevCmd
|
||||||
? ''
|
? `
|
||||||
|
window['__nocobase_public_path__'] = "${process.env.APP_PUBLIC_PATH || '/'}";
|
||||||
|
`
|
||||||
: `
|
: `
|
||||||
window['__webpack_public_path__'] = '{{env.APP_PUBLIC_PATH}}';
|
window['__webpack_public_path__'] = '{{env.APP_PUBLIC_PATH}}';
|
||||||
window['__nocobase_public_path__'] = '{{env.APP_PUBLIC_PATH}}';
|
window['__nocobase_public_path__'] = '{{env.APP_PUBLIC_PATH}}';
|
||||||
@ -36,6 +35,9 @@ export default defineConfig({
|
|||||||
window['__nocobase_ws_path__'] = '{{env.WS_PATH}}';
|
window['__nocobase_ws_path__'] = '{{env.WS_PATH}}';
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
src: `${appPublicPath}browser-checker.js`,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
cacheDirectoryPath: process.env.APP_CLIENT_CACHE_DIR || `node_modules/.cache`,
|
cacheDirectoryPath: process.env.APP_CLIENT_CACHE_DIR || `node_modules/.cache`,
|
||||||
outputPath: path.resolve(__dirname, '../dist/client'),
|
outputPath: path.resolve(__dirname, '../dist/client'),
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
const basename = window['__nocobase_public_path__'] || '/';
|
||||||
|
let currentPath = window.location.pathname;
|
||||||
|
if (!currentPath.startsWith(basename)) {
|
||||||
|
let newPath = basename + (currentPath.startsWith('/') ? currentPath.slice(1) : currentPath);
|
||||||
|
let newUrl = window.location.origin + newPath + window.location.search + window.location.hash;
|
||||||
|
window.location.href = newUrl;
|
||||||
|
}
|
||||||
showLog = true;
|
showLog = true;
|
||||||
function log(m) {
|
function log(m) {
|
||||||
if (window.console && showLog) {
|
if (window.console && showLog) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user