Fix: 帮助文档打包失败v2
This commit is contained in:
@@ -1,12 +1,25 @@
|
||||
/**
|
||||
* Fix lodash.template assignWith issue - Manual fix script
|
||||
* Run this after npm/yarn install and before build
|
||||
*
|
||||
* Emergency patch for lodash.template@4.18.x (broken assignWith).
|
||||
* When package.json "overrides" pins lodash.template@4.5.0, do NOT run this — it is unnecessary and may corrupt the file.
|
||||
*
|
||||
* Usage: node fix-lodash-manual.js
|
||||
*/
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const lodashTemplatePkg = path.join(__dirname, 'node_modules', 'lodash.template', 'package.json');
|
||||
if (fs.existsSync(lodashTemplatePkg)) {
|
||||
try {
|
||||
const ver = JSON.parse(fs.readFileSync(lodashTemplatePkg, 'utf8')).version || '';
|
||||
if (ver.startsWith('4.5.')) {
|
||||
console.log('✓ lodash.template is already 4.5.x (overrides); skip manual patch');
|
||||
process.exit(0);
|
||||
}
|
||||
} catch (e) {
|
||||
/* continue to patch path */
|
||||
}
|
||||
}
|
||||
|
||||
const lodashTemplatePath = path.join(__dirname, 'node_modules', 'lodash.template', 'index.js');
|
||||
|
||||
if (!fs.existsSync(lodashTemplatePath)) {
|
||||
|
||||
Reference in New Issue
Block a user