Git Product home page Git Product logo

clockify-calculator-chrome-extension's People

Watchers

 avatar

clockify-calculator-chrome-extension's Issues

Decrease build file volume

문제 사항: webpack으로 빌드한 파일의 용량(약 4.2 MB)이 크다. webpack으로 빌드하지 않았을 때 용량(415 KB)에 비해 너무 크다.

  • Pure HTML, JS, CSS + minified lib(lodash, moment): 415 KB
  • Webpack development mode build: 4.2 MB
  • Webpack production mode build: 1.6 MB

Webpack Plugin 중 Webpack BundleAnalyzerPlugin 사용하여 분석. 해당 플러그인 사용하여 빌드할 경우, 분석결과를 자동으로 보여준다.

분석결과: moment.js와 lodash 를 사용하는 popup.js의 용량이 큼.

Moment.js 최적화

moment.js 는 모든 locale이 다 들어가서 용량이 커져 locale 제외한 기본 라이브러리만 넣는 방법을 적용.

Moment.js의 대체제를 이용하는 방법도 존재.

Lodash 최적화

lodash-es는 메소드만 사용해서 큰 용량을 차지하지 않을 줄 알았지만, 전체가 다 들어감. lodash 메소드 import 방법 조정 및 LodashModuleReplacementPlugin 적용.

// 메소드 import 방법 1 => development mode에서는 효과가 미미했다.
import { map, reverse } from 'lodash-es'

// 메소드 import 방법 2 => development mode에서는 효과가 대단했다.
import map from 'lodash/map'
import reverse from 'lodash/reverse'

처음에는 메소드 import 방법 1을 사용하였지만 development mode에서는 큰 효과를 볼 수 없었다. (LodashModuleReplacementPlugin README에서는 babel을 사용해야한다는 설명이 있었다.)

Tree shake Lodash Solution 2 ( no babel )을 참고하여 메소드 import 방법 2를 적용해 봄.

결국 production mode에서는 같은 파일 용량.

inline source map 제거

배포용

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.