Nuxt.js: Loading Async/Defer some external resources JS?

Created on 21 Dec 2017  路  3Comments  路  Source: nuxt/nuxt.js

I am importing a external JS file (google map) as external resource, as defined in the documentation
https://nuxtjs.org/faq/

It is working fine.

But if I test my deployed page on Google Speed Insight, it warns me I got some JS loading time to improve for this file: "Your page has 1 blocking script resources. This causes a delay in rendering your page."

Usually I know how to solve the problem: adding an "async" or "defer" to an external js file loaded.
But now with the Nuxt logic I am not sure if it possible.

Question: in Nuxt could I set to load js external resources as "async" or "defer" ? Is this the right approach to solve performance issue?

This question is available on Nuxt.js community (#c2113)

Most helpful comment

Nuxt uses Vue meta, have you tried in this way?

{ src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js', defer: true }

All 3 comments

Nuxt uses Vue meta, have you tried in this way?

{ src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js', defer: true }

@microcipcip : perfect! exactly what I was looking for!
Now I will check Vue Meta a little more ... 馃槂

Thanks

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

msudgh picture msudgh  路  3Comments

mattdharmon picture mattdharmon  路  3Comments

shyamchandranmec picture shyamchandranmec  路  3Comments

nassimbenkirane picture nassimbenkirane  路  3Comments

gary149 picture gary149  路  3Comments