From 57952fe87195b1116e8dc61bb39234ca00172edb Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Thu, 22 Jul 2021 22:34:58 +0800 Subject: [PATCH] more explicit code --- src/compiler/compile/Component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index 12a58c6938..b94b108f43 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -668,7 +668,11 @@ export default class Component { // NOTE: add store variable first, then only $store value // as `$store` will mark `store` variable as referenced and subscribable - const sorted_globals = Array.from(globals.keys()).sort().reverse(); + const global_keys = Array.from(globals.keys()); + const sorted_globals = [ + ...global_keys.filter(key => key[0] !== '$'), + ...global_keys.filter(key => key[0] === '$') + ]; sorted_globals.forEach(name => { if (this.var_lookup.has(name)) return;