testGBP/gcp-config.js

62 lines
2.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const vue2Plugin = require('@gcbp/gcp-cli-plugin-vue2')
const { defineConfig } = require('@gcbp/gcp-cli')
const { version } = require('./package.json')
const buildLocalesPlugin = require('./build/plugins/buildLocales')
// 根据“工作空间+业务领域+Widgets+目标终端”对库名进行修改,全局唯一
const name = 'SmartConstructionWidgetsWeb'
// 需要部署到静态服务域名推荐使用CDN以达到最佳性能与体验
const cdnBaseUrl = 'https://cdn.developer.glodon.com'
const MyBaseUrl = 'https://542634.github.io/testgbp/'
const port = 9099 // 本地调试端口
// 开发框架版本
module.exports = defineConfig(({ mode, env }) => {
const host = mode === 'development' ? `http://localhost:${port}` : cdnBaseUrl
// 本地开发模式使用latest最新版本
const libVersion = mode === 'development' ? 'latest' : version
// 根据工作空间、业务领域修改静态资源路径
const publicPath = `https://542634.github.io/testgbp/`
return {
plugins: [vue2Plugin, buildLocalesPlugin],
appEntry: 'index.js',
server: {
port
},
html: { title: 'Web Business Widgets' },
build: {
target: 'es5',
devVersion: env === 'dev'
},
base: publicPath,
gcpShare: {
name,
// 有exposes输出时必选输出模块的打包类型用于兼容微前端的JS沙箱
library: {
name,
type: 'umd'
},
remoteType: 'script', // 有exposes输出时必选远程库服务引用类型
// 导出配置;删除示例控件后,需同时删除导出
exposes: {
'./basic/NewWidget': './src/widgets/basic/NewWidget.vue',
'./basic/RealTimeData': './src/widgets/basic/RealTimeData.vue',
},
remotes: {
// 开发框架库引用;使用框架最新稳定版本
'@gcbp/web-framework': `promise GcpCliAsyncRemotesConfig.getByName('GCPWebFramework')`
},
shareLib: {
vue: `Vue@${cdnBaseUrl}/vendors/vue/2.6.14/vue.min.js`,
vuex: `Vuex@${cdnBaseUrl}/vendors/vuex/3.6.2/vuex.min.js`,
// 基础组件库引用默认使用latest最新版可修改为固定版本更加稳定
'@geip/basic-components': [
`GCPDesignPro@${cdnBaseUrl}/gcp/gcp-design-pro/latest/index.js`,
`${cdnBaseUrl}/gcp/gcp-design-pro/latest/theme-default/index.css`
]
}
}
}
})