Coder Social home page Coder Social logo

Comments (6)

hurryhuang1007 avatar hurryhuang1007 commented on August 30, 2024

是的,找了半天怎么按需加载, 发现好像不能啊。。

from plugins.

xiaohuoni avatar xiaohuoni commented on August 30, 2024

umi@3 的 model 没有按需加载

from plugins.

hurryhuang1007 avatar hurryhuang1007 commented on August 30, 2024

但是我需要这个功能, 所以umi@3有计划添加这个功能吗

from plugins.

xiaohuoni avatar xiaohuoni commented on August 30, 2024

@sorrycc cc

from plugins.

yuanguandong avatar yuanguandong commented on August 30, 2024

其实主要是model文件虽小,但是数量非常多,首屏加载很耗时,我尝试过codesplit想把这些model合起来,但是发现这样做后虽然index.html里会在加载umi.js后加载models.js, 但页面白屏也不报错

  chunks: [ 'umi','models'],
  chainWebpack: function (config, { env }) {
    config.merge({
      optimization: {
        minimize: env === 'production',
        splitChunks: {
          chunks: 'all',
          minSize: 1,
          minChunks: 1,
          automaticNameDelimiter: '.',
          cacheGroups: {
            vendor: {
              name: 'models',
              test({ resource }: any) {
                const reg1 = /.*[\\/]model.ts/.test(resource)
                const reg2 = /.*[\\/]models\/.*\.ts/.test(resource)
                const merge = reg1 || reg2
                return merge;
              },
              priority: 10,
            },
          },
        },
      },
    });
  },

from plugins.

CoolBerry avatar CoolBerry commented on August 30, 2024

same issue :(

from plugins.

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.