修改打包方式

This commit is contained in:
YeMingfei666 2024-12-26 17:37:28 +08:00
parent 139f198ad5
commit f256740dcb
1 changed files with 14 additions and 14 deletions

View File

@ -32,14 +32,14 @@ gulp.task('create:versionCatalog', gulp.series('build', function () {
// 替换${versionPath}/static/js/manifest.js window.SITE_CONFIG.cdnUrl占位变量
gulp.task('replace:cdnUrl', gulp.series('create:versionCatalog', function () {
return gulp.src(`${versionPath}/static/js/manifest.js`)
.pipe($.replace(new RegExp(`"${require('./config').build.assetsPublicPath}"`, 'g'), 'window.SITE_CONFIG.cdnUrl + "/"'))
.pipe($.revReplace(new RegExp(`"${require('./config').build.assetsPublicPath}"`, 'g'), 'window.SITE_CONFIG.cdnUrl + "/"'))
.pipe(gulp.dest(`${versionPath}/static/js/`))
}))
// 替换${versionPath}/static/config/index-${env}.js window.SITE_CONFIG['version']配置变量
gulp.task('replace:version', gulp.series('create:versionCatalog', function () {
return gulp.src(`${versionPath}/static/config/index-${env}.js`)
.pipe($.replace(/window.SITE_CONFIG\['version'\] = '.*'/g, `window.SITE_CONFIG['version'] = '${version}'`))
.pipe($.revReplace(/window.SITE_CONFIG\['version'\] = '.*'/g, `window.SITE_CONFIG['version'] = '${version}'`))
.pipe(gulp.dest(`${versionPath}/static/config/`))
}))
@ -69,7 +69,7 @@ env = process.env.npm_config_qa ? 'qa' : process.env.npm_config_uat ? 'uat' : 'p
gulp.task('default',
gulp.series('clean',
gulp.parallel('create:versionCatalog', 'replace:cdnUrl', 'replace:version', 'concat:config'),
'build','build-end')
'build', 'build-end')
)