V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
xi_lin
V2EX  ›  Vue.js

vue 项目在 hmr 时 rebuild 特别慢

  •  
  •   xi_lin · 2018-01-03 18:40:58 +08:00 · 5358 次点击
    这是一个创建于 2501 天前的主题,其中的信息可能已经有所发展或是发生改变。

    修改一行就要 rebuild 大概 10s,这效率没法干活了 T_T 看了不少文章说开 dllPlugin 有效,但我们这项目实测也没用

    贴个 progress

    webpack: Compiling...
    308ms building modules
    50ms sealing
    0ms optimizing
    0ms basic module optimization
    6ms module optimization
    3ms advanced module optimization
    53ms basic chunk optimization
    0ms chunk optimization
    0ms advanced chunk optimization
    0ms module and chunk tree optimization
    0ms chunk modules optimization
    1ms advanced chunk modules optimization
    13ms module reviving
    0ms module order optimization
    5ms module id optimization
    6ms chunk reviving
    3ms chunk order optimization
    10ms chunk id optimization
    44ms hashing
    5ms module assets processing
    76ms chunk assets processing
    39ms additional chunk assets processing
    0ms recording
    418ms additional asset processing
    0ms chunk asset optimization
    8396ms asset optimization
     95% emitting
    
     DONE  Compiled successfully in 9512ms
    

    查不到这个 asset optimization 在做啥

     + 52 hidden assets
     [466] (webpack)/hot nonrecursive ^\.\/log$ 170 bytes {5} [built]
           [] -> factory:1ms dependencies:0ms = 1ms
     [499] ./node_modules/moment/locale ^\.\/.*$ 2.88 kB {5} [optional] [built]
           [] -> factory:0ms building:0ms dependencies:1ms = 1ms
    [1048] ./src/module/user/userCredit/userCredit.vue 1.57 kB {7} [built]
           [] -> factory:0ms building:1ms dependencies:5318ms = 5319ms
    [1050] ./node_modules/css-loader?{"minimize":false,"sourceMap":false}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-4eeb260f","scoped":true,"hasInlineConfig":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false}!./node_modules/sass-resources-loader/lib/loader.js?{"resources":"/Users/linxi/Develop/maitao/h5-refactor/src/common/scss/variables.scss"}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/module/user/userCredit/userCredit.vue 4.01 kB {7} [built]
           [] -> factory:0ms building:0ms dependencies:1ms = 1ms
    [1060] ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/module/user/userCredit/userCredit.vue 5.69 kB {7} [built]
           [] -> factory:1ms building:44ms dependencies:14ms = 59ms
    [1061] ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-4eeb260f","hasScoped":true,"transformToRequire":{"video":"src","source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/module/user/userCredit/userCredit.vue 3.15 kB {7} [built]
           [] -> factory:1ms building:58ms = 59ms
        + 1156 hidden modules
    

    就是当前修改的那个 vue 文件 dependencies 耗时巨长

    项目是拿 vue-cli 建出来的,不知道怎么能进一步 profile?

    第 1 条附言  ·  2018-01-03 20:25:33 +08:00
    试到解决方案了,用了这个改版的库 https://github.com/daifee/html-webpack-plugin-for-multihtml
    因为我们是多 entry 项目

    不过还是不知道怎么 profile,不然应该能找点发现
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2360 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 15:48 · PVG 23:48 · LAX 07:48 · JFK 10:48
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.