Code Monkey home page Code Monkey logo

Comments (1)

kb-coder avatar kb-coder commented on June 15, 2024

@ricky11 Yes, you do have to add the config.pluigins.delete('prefetch'). Good job there.

Vuex is global, so I don't think there is a way around loading it globally. One technique I use in my router is to load the initial state or look up values for that module in a beforeRouteEnter. If it is a heavy process to load the initial state, then you may not want to do that because the user experience may not be good.

For the vendors chunk, you can try different regex combinations and do like what I did on the Vue section in the vue.config:

config.optimization.set('splitChunks', {
        cacheGroups: {
          // aws modules
          aws: {
            test: /[\\/]node_modules[\\/](aws.*)[\\/]/, // this is not exact, but change this to be whatever matching works.
            name: 'aws',
            enforce: true,
            priority: 20,
            chunks: 'initial',
          },

You'll want to be sure to exclude this new package from vendors:

vendors: {
            name: 'chunk-vendors',
            test(module) {
              // `module.resource` contains the absolute path of the file on disk.
              // Note the usage of `path.sep` instead of / or \, for cross-platform compatibility.
              return module.resource
              && !module.resource.includes(`${path.sep}node_modules${path.sep}@vue`)
              && !module.resource.includes(`${path.sep}node_modules${path.sep}vue`)
              && !module.resource.includes(`${path.sep}node_modules${path.sep}aws`) // added this
              && !module.resource.includes(`${path.sep}src${path.sep}`);
            },

Hope that helps!

from lazydemo.

Related Issues (1)

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.