diff --git a/package-lock.json b/package-lock.json index 8ca30f5..ae63ae7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "@babel/cli": "^8.0.4", "@babel/core": "^8.0.1", "@babel/preset-react": "^8.0.1", + "@babel/standalone": "^7.29.8", "jsdom": "^30.0.1", "react": "^19.2.8", "react-dom": "^19.2.8" @@ -355,6 +356,15 @@ "@babel/core": "^8.0.0" } }, + "node_modules/@babel/standalone": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/standalone/-/standalone-7.29.8.tgz", + "integrity": "sha512-XgbPNz+u6JzB7cKGnPDoS1U24J5td8yp3HFWbT/6f4/ASZ0PqaQGIvts1o5v5AI+f6i3jdVB/L/o2CYLCv101A==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/template": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/@babel/template/-/template-8.0.0.tgz", diff --git a/package.json b/package.json index 8e408af..1dafa6c 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "@babel/cli": "^8.0.4", "@babel/core": "^8.0.1", "@babel/preset-react": "^8.0.1", + "@babel/standalone": "^7.29.8", "jsdom": "^30.0.1", "react": "^19.2.8", "react-dom": "^19.2.8" diff --git a/wiki.md b/wiki.md index 6d57283..234aab4 100644 --- a/wiki.md +++ b/wiki.md @@ -1,3 +1,9 @@ +### [2026-08-08] FIX: build.mjs ERR_MODULE_NOT_FOUND '@babel/standalone' trên Windows — package.json thiếu dependency +- **Tóm tắt thay đổi:** User chạy build_windows.ps1 (bước 2/6 node build.mjs) nhận `Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@babel/standalone' imported from build.mjs`. Root cause: `build.mjs` import `@babel/standalone` nhưng **package.json KHÔNG khai báo** dependency này (máy dev có sẵn trong node_modules từ trước nên không lộ; máy Windows `npm install` chỉ cài theo package.json → thiếu). Fix: thêm `"@babel/standalone": "^7.29.8"` vào dependencies + chạy `npm install` cập nhật `package-lock.json`. +- **Các file ảnh hưởng:** `package.json` (+@babel/standalone), `package-lock.json` (npm install) +- **Ghi chú/Test (nếu có):** npm install OK (up to date), package-lock có node_modules/@babel/standalone, `node build.mjs` BUILD OK 1123403 bytes + node --check OK. User: pull code mới rồi chạy lại build_windows.ps1. + +--- ### [2026-08-08] FIX: verify bundle [3.5/6] false-positive 'app/static thieu' + check spec version — tools/verify_bundle.py - **Tóm tắt thay đổi:** User chạy build_windows.ps1 — bước verify [3.5/6] mới báo "ERROR: Bundle thieu: app/static, app/templates" nhưng thực tế bundle ĐỦ (collect_data_files('app') đã hoạt động — verify bằng build Linux). Root cause: script verify cũ dùng regex `-notmatch "app/static"` trên raw TOC — trên Windows TOC chứa `app\static` (BACKSLASH) → regex forward-slash không match → FALSE POSITIVE báo thiếu. Fix: 1. **tools/verify_bundle.py** (mới): verify TOC bằng Python — đọc text, `replace('\\','/')` normalize backslash→forward, regex theo prefix `app/static(?=[/'"]|$)`; exit 0 OK / 1 thiếu; không có TOC → WARN + exit 0 (không chặn build). Test 4 case: backslash OK, forward OK, thiếu static → ERROR, không TOC → WARN.