You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
const { routeMappingPlugin } = require('../plugins/route-mapping-plugin.js') |
|
|
const { existsSync } = require('fs') |
|
|
const { resolve } = require('path') |
|
|
|
|
|
// 检查命令行参数 |
|
|
const isCheckOnly = process.argv.includes('--check-only') |
|
|
|
|
|
// 独立运行路由映射生成 |
|
|
if (isCheckOnly) { |
|
|
console.log('🔍 检查路由映射文件状态...') |
|
|
|
|
|
const outputPath = resolve(__dirname, '../src/renderer/modules/route-sync/direct-route-mappings.js') |
|
|
|
|
|
if (existsSync(outputPath)) { |
|
|
console.log('✅ 路由映射文件已存在,webpack插件将处理更新') |
|
|
process.exit(0) |
|
|
} else { |
|
|
console.log('⚠️ 路由映射文件不存在,需要生成') |
|
|
// 继续执行生成逻辑 |
|
|
} |
|
|
} else { |
|
|
console.log('🔧 独立生成路由映射文件...') |
|
|
} |
|
|
|
|
|
try { |
|
|
const plugin = routeMappingPlugin() |
|
|
plugin.collectDirectMappings() |
|
|
console.log('✅ 路由映射文件生成完成') |
|
|
} catch (error) { |
|
|
console.error('❌ 路由映射文件生成失败:', error) |
|
|
process.exit(1) |
|
|
} |
|
|
|
|
|
|