build: 接入 BuildBundlerMinifier 自动重建 bundle 产物并剥离源文件 BOM

- 根因:页面(_MainLayout 等)加载的是 bundle.js 等由 bundleconfig.json 打包的生成产物,
  但 csproj 未接入 BundlerMinifier,dotnet build 不会重生它们,Jenkins 只是把 git 里
  陈旧的 bundle.js 原样发布 -> 改了 fastVue.base.js 后回车不生效(部署的 bundle 仍是无
  enter 的旧版)。且源文件带 UTF-8 BOM,拼接后每个 BOM 落入文件中间成为 ZWNBSP,提交
  diff 充满不可见字符(历史上曾多次在产物上手工清 BOM 打补丁)。
- 修复:
  1. YLErpWeb.csproj 新增 BuildBundlerMinifier(3.2.449);其 BundleMinify 目标在
     BeforeCompile 自动按 bundleconfig.json 重建全部 bundle,Jenkins 构建即自动产出正确版本,
     不再需要手工重建并提交 bundle.js。
  2. .gitignore 忽略 8 个生成产物(jquery.js/bundle.js/vue.js/bundle.css/bundleV2.css/
     bundleV2.js/bundle.min.css/bundleV2.min.css) 并 git rm --cached 取消跟踪;这些产物
     永不再入版本库、永不陈旧。
  3. 剥离 15 个喂给 bundle 的源文件(及 css)开头的 UTF-8 BOM,使重建产物不再含 ZWNBSP。
- 验证:本地 dotnet build -t:BundleMinify 重建后 8 个 bundle 全部 BOM=0,bundle.js 含完整
  enter 链路(_enterFired/isEnter/$emit('enter'));删除 bundle.min.css 后构建可自动重建。
This commit is contained in:
hjhan
2026-07-29 15:42:35 +08:00
parent 7fc4babc28
commit 14ed09d628
24 changed files with 26 additions and 26842 deletions
+11
View File
@@ -231,3 +231,14 @@ logfile
/.idea/.idea.YLerpbase/.idea
/NuGet.Config
/.trae
# BundlerMinifier 生成产物(由 dotnet build 依据 bundleconfig.json 自动重建,禁止提交)
# 之前手工提交导致测试环境拉到陈旧 / 含 BOM(ZWNBSP) 的产物;接入 BuildBundlerMinifier 后由构建自动生成
/YLErpWeb/wwwroot/Statics/bundles/jquery.js
/YLErpWeb/wwwroot/Statics/bundles/bundle.js
/YLErpWeb/wwwroot/Statics/bundles/vue.js
/YLErpWeb/wwwroot/Statics/bundles/bundle.css
/YLErpWeb/wwwroot/Statics/bundles/bundleV2.css
/YLErpWeb/wwwroot/Statics/bundles/bundleV2.js
/YLErpWeb/wwwroot/Statics/bundles/bundle.min.css
/YLErpWeb/wwwroot/Statics/bundles/bundleV2.min.css
+1
View File
@@ -20,6 +20,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BuildBundlerMinifier" Version="3.2.449" />
<PackageReference Include="Lazy.Captcha.Core" Version="2.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.9" />
@@ -1,4 +1,4 @@
var main = main || {};
var main = main || {};
(function ($) {
+1 -1
View File
@@ -1,4 +1,4 @@
//依赖类库:lodash.js + jquery + jquery.validate + bootstrap.emodal.js
//依赖类库:lodash.js + jquery + jquery.validate + bootstrap.emodal.js
var main = window.main || { version: "1.0" };
@@ -1,4 +1,4 @@
(function (window, $) {
function FastVue() {
@@ -1,4 +1,4 @@
//日期选择组件FastVue.DatePicker
//日期选择组件FastVue.DatePicker
(function (global) {
global.vueDatePicker = function () {
return {
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
@font-face { font-family: 'Glyphicons Halflings'; src: url('../fonts/glyphicons-halflings-regular.eot'); src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); }
@font-face { font-family: 'Glyphicons Halflings'; src: url('../fonts/glyphicons-halflings-regular.eot'); src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); }
.glyphicon { position: relative; top: 1px; display: inline-block; font-family: 'Glyphicons Halflings'; font-style: normal; font-weight: normal; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.glyphicon-asterisk:before { content: "\002a"; }
.glyphicon-plus:before { content: "\002b"; }
+1 -1
View File
@@ -1 +1 @@
window.moment = dayjs;
window.moment = dayjs;
@@ -1,4 +1,4 @@
@charset "UTF-8";
@charset "UTF-8";
/**
* Dashboard UI
*/
@@ -1,4 +1,4 @@
/* ========================================================================
/* ========================================================================
* SaRibe: eModal.js v1.2.67
* http://saribe.github.io/eModal
* ========================================================================
@@ -1,4 +1,4 @@
Vue.directive('disabled', {
Vue.directive('disabled', {
update: function (newValue) {
if (newValue) {
$(this.el).prop("disabled", true);
+1 -1
View File
@@ -1,4 +1,4 @@
/**************************************************
/**************************************************
bootstrap样式扩展(组件前缀相同但自定义修饰类)
****************************************************/
/****utils****/
+1 -1
View File
@@ -1,4 +1,4 @@
/*******************************************
/*******************************************
重写bootstrap样式
*********************************************/
/***layout***/
+1 -1
View File
@@ -1,4 +1,4 @@
/**************************************************
/**************************************************
定义整个页面用到的通用样式(脱离框架自定义的样式类)
****************************************************/
+1 -1
View File
@@ -1,4 +1,4 @@
/*********************
/*********************
用于重置浏览器基础样式
***********************/
body, html { height: 100%; width: 100%; min-height: 100%; }
+1 -1
View File
@@ -1,4 +1,4 @@
/**************************************************
/**************************************************
改写第三方组件样式类
****************************************************/