Kiriz
V2EX  ›  问与答

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

  •  
  •   Kiriz · Sep 3, 2018 · 2687 views
  •   You need to sign in to view this topic
    This topic created in 3014 days ago, the information mentioned may be changed or developed.

    使用 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 replies  •  2018-09-03 13:55:43 +08:00
    Kiriz
    Kiriz
    OP
    Sep 3, 2018
    1
    试了一下 nginx 不用 80 端口就秒加载,用 80 端口这个文件就需要加载 6s,这是什么操作?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2044 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 12:33 · PVG 20:33 · LAX 04:33 · JFK 07:33
    ♥ Do have faith in what you're doing.