Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion designer-demo/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ import { HttpService } from './src/composable'

const baseURL = import.meta.env.BASE_URL || '.'
const baseURLWithoutSlash = baseURL.replace(/\/$/, '')
const hasPreviewUrl = Object.prototype.hasOwnProperty.call(import.meta.env, 'VITE_PREVIEW_URL')
const previewUrl = hasPreviewUrl
? import.meta.env.VITE_PREVIEW_URL
: ['production', 'alpha'].includes(import.meta.env.MODE)
? `${baseURLWithoutSlash}/preview.html`
Comment thread
xuanlid marked this conversation as resolved.
: ''

export default {
[META_SERVICE.Http]: HttpService,
Expand Down Expand Up @@ -51,7 +57,7 @@ export default {
options: {
// 配置预览跳转的 url:根据实际业务需求进行配置
// 文档:https://opentiny.design/tiny-engine#/help-center/course/dev/preview-api
previewUrl: ['prod', 'alpha'].includes(import.meta.env.MODE) ? `${baseURLWithoutSlash}/preview.html` : ''
previewUrl
}
}
}
8 changes: 7 additions & 1 deletion packages/engine-cli/template/designer/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ import { HttpService } from './src/composable'

const baseURL = import.meta.env.BASE_URL || '.'
const baseURLWithoutSlash = baseURL.replace(/\/$/, '')
const hasPreviewUrl = Object.prototype.hasOwnProperty.call(import.meta.env, 'VITE_PREVIEW_URL')
const previewUrl = hasPreviewUrl
? import.meta.env.VITE_PREVIEW_URL
: ['production', 'alpha'].includes(import.meta.env.MODE)
? `${baseURLWithoutSlash}/preview.html`
: ''

export default {
[META_SERVICE.Http]: HttpService,
Expand Down Expand Up @@ -51,7 +57,7 @@ export default {
options: {
// 配置预览跳转的 url:根据实际业务需求进行配置
// 文档:https://opentiny.design/tiny-engine#/help-center/course/dev/preview-api
previewUrl: ['prod', 'alpha'].includes(import.meta.env.MODE) ? `${baseURLWithoutSlash}/preview.html` : ''
previewUrl
}
}
}
Loading