mirror of
https://github.com/cool-team-official/cool-admin-midway-packages.git
synced 2025-12-11 05:42:49 +00:00
兼容二进制打包
This commit is contained in:
parent
80ad8a61dc
commit
da2bab9d71
@ -17,7 +17,10 @@ export function generateEntitiesFile() {
|
||||
|
||||
// 生成导入语句和导出数组
|
||||
const imports = entityFiles.map((file, index) => {
|
||||
const relativePath = path.relative(path.dirname(OUTPUT_FILE), file);
|
||||
const relativePath = path
|
||||
.relative(path.dirname(OUTPUT_FILE), file)
|
||||
.split(path.sep)
|
||||
.join('/');
|
||||
return `import * as entity${index} from './${relativePath.replace(
|
||||
/\.ts$/,
|
||||
''
|
||||
|
||||
@ -31,7 +31,11 @@ class LocationUtil {
|
||||
const fileName = site.getFileName();
|
||||
// 如果文件名不存在,则跳过
|
||||
if (!fileName || !fs.existsSync(fileName)) continue;
|
||||
if (!fileName.includes('/modules/')) continue;
|
||||
if (
|
||||
!fileName.includes('/modules/') &&
|
||||
!fileName.includes('\\modules\\')
|
||||
)
|
||||
continue;
|
||||
targetFile = {
|
||||
path: fileName,
|
||||
line: site.getLineNumber(),
|
||||
@ -56,9 +60,12 @@ class LocationUtil {
|
||||
const err = new Error();
|
||||
const callerfile = err.stack.split('\n')[2].match(/\(([^)]+)\)/)[1];
|
||||
const dirPath = path.dirname(callerfile);
|
||||
const nodeModulesIndex = dirPath.indexOf('/node_modules/');
|
||||
const nodeModulesIndex =
|
||||
dirPath.indexOf('/node_modules/') !== -1
|
||||
? dirPath.indexOf('/node_modules/')
|
||||
: dirPath.indexOf('\\node_modules\\');
|
||||
if (nodeModulesIndex !== -1) {
|
||||
return dirPath.substring(0, nodeModulesIndex) + '/dist';
|
||||
return path.join(dirPath.substring(0, nodeModulesIndex), 'dist');
|
||||
}
|
||||
return dirPath;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user