Перейти к содержимому

1,247 Packages for 4,000 Lines — npm, node-gyp and webpack 3, December 2017 · 1080p Electronic

Busy Work Labs

0:00 / 0:00

1,247 Packages for 4,000 Lines — npm, node-gyp and webpack 3, December 2017 · 1080p Electronic

19 просмотров · 7 дней назад
Busy Work Labs
11 подписчиков
19 просмотров · 7 дней назад
An iTerm2 window on macOS High Sierra, one Saturday night in December 2017. No application code is written. The hour is a dependency install and a bundler, and one of those dependencies turns out to be C++. package.json lists nineteen things. package-lock.json resolves them into 1,247, and installing them puts 88,000 files and 241 MB on disk for a project with 4,000 lines of its own JavaScript. One package fails: node-sass cannot download a prebuilt binding for Node 8 on darwin, falls back to compiling libsass itself, and node-gyp refuses because Homebrew put Python 3.6 ahead of the system Python 2.7 in PATH. gyp is a Chromium tool written for Python 2, and it will not budge. One line in .npmrc fixes it, and then eighty-eight C++ translation units compile inside what is nominally a JavaScript install. Then webpack 3. The first build is 2.44 MB in one file, and it warns you about that twice. lodash is 540 KB of it for three functions, because webpack cannot tree shake CommonJS. Source maps turn out to cost more than the bundle. CommonsChunkPlugin splits vendor from app so a code change invalidates 62 KB instead of 380. And tree shaking needs two separate changes — babel with modules:false so webpack sees ES modules at all, and lodash-es so there is something to shake — which together take vendor from 318 KB to 108. Sixty-one kilobytes gzipped, all in. webpack 4 ships in February and changes half of this. An hour of bright, steady instrumental — music only, no typing sounds. 1 hour, 1920×1080, with sound. Music from #Uppbeat (free for Creators!): https://uppbeat.io/music/tracks/bach/... License code: ZYWGLO3NJUJRTWZD #nodejs #npm #webpack #javascript #frontend #nodegyp #nodesass #compiling #2017 #macos #treeshaking #bundler #busyworklabs #musiconly #focus #deepwork #programming