testGBP/gcp-config.js

58 lines
2.0 KiB
JavaScript
Raw 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')
// 修改库名为智慧工地相关
const name = 'SmartConstructionWidgetsWeb'
// 修改为智慧工地的CDN域名
const cdnBaseUrl = 'https://cdn.smartconstruction.com'
const port = 9099 // 本地调试端口
// 开发框架版本
module.exports = defineConfig(({ mode, env }) => {
const host = mode === 'development' ? `http://localhost:${port}` : cdnBaseUrl
const libVersion = mode === 'development' ? 'latest' : version
const publicPath = `${host}/smart-construction/widgets/${libVersion}/`
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/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`
]
}
}
}
})