Giter Site home page Giter Site logo

Lazy loading about nuxt.js HOT 4 CLOSED

nuxt avatar nuxt commented on April 28, 2024
Lazy loading

from nuxt.js.

Comments (4)

Atinux avatar Atinux commented on April 28, 2024 2

@dan-gamble if you want to use highlight.js only on a specific page component, juste import it in your page component:

pages/about.vue:

<script>
import highlightjs from 'highlight.js'

export default {
}
</script>

Make sure that you don't use highlight.js in your config.build.vendor and config.plugins.

This way, highlight.js will be in the bundle of the /about page and we will be imported only when loading this route πŸ‘

This is due to the code splitting we define in the router of Nuxt.js, like @declandewet described in his comment.

from nuxt.js.

zspecza avatar zspecza commented on April 28, 2024

Hi @dan-gamble - I haven't used Nuxt.js much but @Atinux and I discussed this a lot a few weeks ago so based on that my assumption is it should be possible - and the in the code it looks like it is the default for the client build: https://github.com/nuxt/nuxt.js/blob/master/lib/app/router.js#L9

from nuxt.js.

dan-gamble avatar dan-gamble commented on April 28, 2024

Awesome, thanks guys.

from nuxt.js.

lock avatar lock commented on April 28, 2024

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.

from nuxt.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.