2017-03-30 14 views
1

저는 프론트 엔드 개발과 angular2 앱에 약간의 문제가 있습니다. 아래의 타임 라인 캡처를 볼 수 있듯이각도 2 polyfills 초기화가 너무 오래 걸림

는 polyfills의 TAKS 너무 오랜 시간 (거의 육초는!) chrome timeline 그것은 정상이 보인다. 하지만,이 polyfills 시간을 줄이기 위해 내가 무엇을 할 수 있는지 전혀 모른다.

conf의 일부 줄.

// Add build specific plugins 
    if (ENV === 'build') { 
    config.plugins.push(
     // Reference: http://webpack.github.io/docs/list-of-plugins.html#noerrorsplugin 
     // Only emit files when there are no errors 
     new webpack.NoErrorsPlugin(), 

     // Reference: http://webpack.github.io/docs/list-of-plugins.html#dedupeplugin 
     // Dedupe modules in the output 
     new webpack.optimize.DedupePlugin(), 

     // Reference: http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin 
     // Minify all javascript, switch loaders to minimizing mode 
     new webpack.optimize.UglifyJsPlugin({ 
      compress: { warnings: false } 
     }) 
    ); 
    } 

전체 webpack.config.js 내 앱에서 사용합니다. https://gist.github.com/jeesim2/484186d630fedc9f42e264ca905ad123

내 각 버전

"@angular/common": "^2.0.1", 
"@angular/compiler": "^2.0.1", 
"@angular/core": "^2.0.1", 
"@angular/forms": "^2.0.1", 
"@angular/http": "^2.0.1", 
"@angular/platform-browser": "^2.0.1", 
"@angular/platform-browser-dynamic": "^2.0.1", 
"@angular/router": "^3.0.1", 

webpack.optimize.UglifyJsPlugin은 70 % 패키지 크기를 감소하지만, 페이지 로딩 속도가 빨라되지 않았습니다. enter image description here

왜이 긴 페이지로드가 발생합니까?

답변

0

angle2 단일 페이지 응용 프로그램에 오신 것을 환영합니다. :). A2는 아직 개발 상태에있는 IMHO입니다. 이 동작은 정상이며 OS/브라우저/구성 요소에 따라 달라집니다. 숫자 렌더링에는 몇 초가 걸립니다. A2/vendors/polyfills가 포함 된 번들 파일은 약 800kb + (최소 크기)이므로 브라우저 메모리로 모두 읽는 데 시간이 걸립니다.

렌더링이 매우 빠르지 만 스크립트가 초기화 된 후 몇 초 동안 백그라운드에서 실행될 수 있는지 확인할 수 있습니다. 빠른 PC에서도 시간이 걸립니다.