编译i18时font中的componentPath缺少根目录导致编译不出
This commit is contained in:
parent
5b3bf17ace
commit
8708a9afec
|
|
@ -156,11 +156,11 @@ class LocaleBuilder {
|
|||
buildproject(root, src, watch) {
|
||||
const packageJson = (0, path_1.join)(root, 'package.json');
|
||||
const { name } = require(packageJson);
|
||||
const pagePath = (0, path_1.join)(src ? 'src' : 'lib', 'pages');
|
||||
const pagePath = (0, path_1.join)(root, src ? 'src' : 'lib', 'pages');
|
||||
if (fs_1.default.existsSync(pagePath)) {
|
||||
this.traverse(name, 'p', pagePath, (0, path_1.join)(root, pagePath), false, 'locales', watch);
|
||||
}
|
||||
const componentPath = (0, path_1.join)(src ? 'src' : 'lib', 'components');
|
||||
const componentPath = (0, path_1.join)(root, src ? 'src' : 'lib', 'components');
|
||||
if (fs_1.default.existsSync(componentPath)) {
|
||||
this.traverse(name, 'c', componentPath, (0, path_1.join)(root, componentPath), false, 'locales', watch);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,22 +81,22 @@ export default class LocaleBuilder {
|
|||
];
|
||||
|
||||
// 改为在初始化时合并
|
||||
/* if (this.dependencies) {
|
||||
this.dependencies.forEach(
|
||||
(ele, idx) => statements.push(
|
||||
factory.createImportDeclaration(
|
||||
undefined,
|
||||
factory.createImportClause(
|
||||
false,
|
||||
factory.createIdentifier(`i18ns${idx}`),
|
||||
undefined
|
||||
),
|
||||
factory.createStringLiteral(`${ele}/lib/data/i18n`),
|
||||
undefined
|
||||
)
|
||||
)
|
||||
)
|
||||
} */
|
||||
/* if (this.dependencies) {
|
||||
this.dependencies.forEach(
|
||||
(ele, idx) => statements.push(
|
||||
factory.createImportDeclaration(
|
||||
undefined,
|
||||
factory.createImportClause(
|
||||
false,
|
||||
factory.createIdentifier(`i18ns${idx}`),
|
||||
undefined
|
||||
),
|
||||
factory.createStringLiteral(`${ele}/lib/data/i18n`),
|
||||
undefined
|
||||
)
|
||||
)
|
||||
)
|
||||
} */
|
||||
|
||||
statements.push(
|
||||
factory.createVariableStatement(
|
||||
|
|
@ -179,13 +179,13 @@ export default class LocaleBuilder {
|
|||
);
|
||||
}
|
||||
else { */
|
||||
statements.push(
|
||||
factory.createExportAssignment(
|
||||
undefined,
|
||||
undefined,
|
||||
factory.createIdentifier("i18ns")
|
||||
)
|
||||
);
|
||||
statements.push(
|
||||
factory.createExportAssignment(
|
||||
undefined,
|
||||
undefined,
|
||||
factory.createIdentifier("i18ns")
|
||||
)
|
||||
);
|
||||
/* } */
|
||||
|
||||
const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });
|
||||
|
|
@ -246,14 +246,14 @@ export default class LocaleBuilder {
|
|||
private buildproject(root: string, src?: boolean, watch?: boolean) {
|
||||
const packageJson = join(root, 'package.json');
|
||||
const { name } = require(packageJson);
|
||||
const pagePath = join(src ? 'src' : 'lib', 'pages');
|
||||
const pagePath = join(root, src ? 'src' : 'lib', 'pages');//编译i18时font中的componentPath缺少根目录导致编译不出
|
||||
if (fs.existsSync(pagePath)) {
|
||||
this.traverse(name, 'p', pagePath, join(root, pagePath), false, 'locales', watch);
|
||||
}
|
||||
|
||||
const componentPath = join(src ? 'src' : 'lib', 'components');
|
||||
|
||||
const componentPath = join(root, src ? 'src' : 'lib', 'components');
|
||||
if (fs.existsSync(componentPath)) {
|
||||
this.traverse(name, 'c', componentPath, join(root, componentPath), false, 'locales', watch);
|
||||
this.traverse(name, 'c', componentPath, join(root, componentPath), false, 'locales', watch);
|
||||
}
|
||||
|
||||
const localePath = join(root, src ? 'src' : 'lib', 'locales');
|
||||
|
|
|
|||
Loading…
Reference in New Issue