$log.break and $log.trace no-op during SSR

pull/9670/head
Rich Harris 12 months ago
parent f18154721e
commit 6daa422887

@ -630,22 +630,18 @@ const javascript_visitors_runes = {
if (rune === '$effect.active') {
return b.literal(false);
}
if (rune === '$log' || rune === '$log.break' || rune === '$log.trace') {
if (state.options.dev) {
const args = /** @type {import('estree').Expression[]} */ (
node.arguments.map((arg) => visit(arg))
);
return b.call('console.log', ...args);
}
return b.unary('void', b.literal(0));
}
if (rune === '$log.table') {
if (state.options.dev) {
if (rune?.startsWith('$log')) {
if ((rune === '$log' || rune === '$log.table') && state.options.dev) {
const callee = rune === '$log' ? 'console.log' : 'console.table';
const args = /** @type {import('estree').Expression[]} */ (
node.arguments.map((arg) => visit(arg))
);
return b.call('console.table', ...args);
return b.call(callee, ...args);
}
return b.unary('void', b.literal(0));
}

Loading…
Cancel
Save