should be 
but the weird thing is it’s not working in some pages…
add_action('wp_enqueue_scripts', function () {
wp_enqueue_style('sage/main.css', asset_path('styles/main.css'), false, null);
wp_enqueue_script('sage/main.js', asset_path('scripts/main.js'), ['jquery'], null, true);
global $template;
$page = explode('.', basename($template));
$wp = array(
'ajaxUrl' => admin_url('admin-ajax.php'),
'security' => \App\Ajax::getNonce(),
'homeUrl' => get_option('home'),
'postsPerPage' => get_option('posts_per_page'),
'permalink' => get_permalink(),
'templateUri' => get_template_directory_uri(),
'template' => $page[0],
'lang' => defined('ICL_LANGUAGE_CODE') ? ICL_LANGUAGE_CODE : false,
'isMobile' => App::getMobileDetect()->isMobile(),
'isLoggedIn' => is_user_logged_in()
);
wp_localize_script('sage/main.js', 'wp', $wp);
if (is_single() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}, 100);