V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Kiriz
V2EX  ›  问与答

webpack 打包后请求 manifest.js 需要 6 秒以上,请问是什么问题?

  •  
  •   Kiriz · 2018-09-03 11:58:33 +08:00 · 1495 次点击
    这是一个创建于 2053 天前的主题,其中的信息可能已经有所发展或是发生改变。

    使用 nginx,请求 app.js,vendor.js 都是 100ms 内加载,唯有 manifest.js 每次都需要 6 秒以上( TTFB),请问是哪方面出了问题呢? manifest.js 如下:

    !function(r){var n=window.webpackJsonp;window.webpackJsonp=function(e,u,c){for(var f,i,p,a=0,l=[];a<e.length;a++)i=e[a],o[i]&&l.push(o[i][0]),o[i]=0;for(f in u)Object.prototype.hasOwnProperty.call(u,f)&&(r[f]=u[f]);for(n&&n(e,u,c);l.length;)l.shift()();if(c)for(a=0;a<c.length;a++)p=t(t.s=c[a]);return p};var e={},o={2:0};function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=r,t.c=e,t.d=function(r,n,e){t.o(r,n)||Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:e})},t.n=function(r){var n=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(n,"a",n),n},t.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},t.p="/",t.oe=function(r){throw console.error(r),r}}([]);
    

    nginx 如下:

    server {
    	listen       80;
    	server_name  127.0.0.1;
    
    
    	location / {
        		root   /var/www/project/dist;
        		index  index.html index.htm;
        		try_files $uri $uri/ /index.html;
    	}
    	location ^~/api/ { proxy_pass http://127.0.0.1:5438/api/; }
    }
    
    1 条回复    2018-09-03 13:55:43 +08:00
    Kiriz
        1
    Kiriz  
    OP
       2018-09-03 13:55:43 +08:00
    试了一下 nginx 不用 80 端口就秒加载,用 80 端口这个文件就需要加载 6s,这是什么操作?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5921 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 01:58 · PVG 09:58 · LAX 18:58 · JFK 21:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.