Skip to content

Commit f2c4228

Browse files
committed
fix: hanging of the build because loader could not resolve
1 parent 425ad42 commit f2c4228

3 files changed

Lines changed: 23 additions & 27 deletions

File tree

cmp/compiler/src/plugin/dev-server-loader.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,32 @@ export default async function devServerLoader(
1717
logger.debug("Running devServerLoader");
1818
const callback = this.async();
1919
const isDev = process.env.NODE_ENV === "development";
20-
if (!isDev) {
21-
return;
22-
}
2320

2421
const config: LingoConfig = this.getOptions();
2522
const startPort = config.dev.serverStartPort;
2623

27-
if (!serverPromise) {
28-
serverPromise = startOrGetTranslationServer({
29-
startPort,
30-
onError: (err) => {
31-
logger.error("Translation server error:", err);
32-
},
33-
onReady: () => {
34-
logger.info("Translation server started");
35-
},
36-
config,
37-
});
38-
}
24+
let server;
25+
if (!isDev) {
26+
if (!serverPromise) {
27+
serverPromise = startOrGetTranslationServer({
28+
startPort,
29+
onError: (err) => {
30+
logger.error("Translation server error:", err);
31+
},
32+
onReady: () => {
33+
logger.info("Translation server started");
34+
},
35+
config,
36+
});
37+
}
3938

40-
// Wait for server with timeout to prevent compilation from hanging
41-
const server = await withTimeout(
42-
serverPromise,
43-
DEFAULT_TIMEOUTS.SERVER_START,
44-
"Translation server startup",
45-
);
39+
// Wait for server with timeout to prevent compilation from hanging
40+
server = await withTimeout(
41+
serverPromise,
42+
DEFAULT_TIMEOUTS.SERVER_START,
43+
"Translation server startup",
44+
);
45+
}
4646

4747
callback(
4848
null,

cmp/compiler/src/plugin/transform/parse-override.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,12 @@ export function validateOverrides(overrides: Record<string, string>): boolean {
171171
export function findOverrideAttribute(
172172
attributes: (t.JSXAttribute | t.JSXSpreadAttribute)[],
173173
): JSXAttribute | undefined {
174-
console.log(`[FIND_OVERRIDE] Searching in ${attributes.length} attributes`);
175174
const found = attributes.find(
176175
(attr): attr is JSXAttribute =>
177176
t.isJSXAttribute(attr) &&
178177
t.isJSXIdentifier(attr.name) &&
179178
attr.name.name === OVERRIDE_ATTRIBUTE,
180179
);
181-
console.log(`[FIND_OVERRIDE] Found override attribute: ${!!found}`);
182180
return found;
183181
}
184182

cmp/compiler/src/plugin/transform/process-file.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ function processJSXElement(
427427
textNode = path.node.children[textNodeIndex] as t.JSXText;
428428
}
429429
}
430-
logger.warn(`Type: ${type}`);
431430

432431
if (!type) {
433432
return;
@@ -468,7 +467,6 @@ function processJSXElement(
468467

469468
if (type === "mixed") {
470469
path.node.children = [constructTranslationCall(entry.hash, text, args)];
471-
path.skip();
472470
} else {
473471
path.node.children = path.node.children.map((it, index) => {
474472
if (index === textNodeIndex) {
@@ -480,8 +478,8 @@ function processJSXElement(
480478
return it;
481479
}
482480
});
483-
path.skip();
484481
}
482+
path.skip();
485483
}
486484

487485
/**
@@ -622,7 +620,7 @@ function processComponentFunction(
622620
isAsync: path.node.async,
623621
};
624622
state.componentsStack.push(componentEntry);
625-
console.debug(`Component ${JSON.stringify(componentEntry)} entered`);
623+
logger.debug(`Component ${JSON.stringify(componentEntry)} entered`);
626624

627625
path.setData("componentName", componentName);
628626
path.traverse(componentVisitors, { visitorState: state });

0 commit comments

Comments
 (0)