Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Make Snacks: Yet Another JavaScript Build System
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Brian Hicks
September 07, 2017
Technology
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Make Snacks: Yet Another JavaScript Build System
Brian Hicks
September 07, 2017
More Decks by Brian Hicks
See All by Brian Hicks
Esperanto
brianhicks
0
170
Snake Snacks: Function Composition, The Dumb Way
brianhicks
0
190
State of Elm 2017
brianhicks
1
590
µKanren: A Minimal Functional Core for Relational Programming
brianhicks
0
480
Terraform All The Things!
brianhicks
2
440
Kubernetes for the Mesos User
brianhicks
1
150
ch-ch-ch-ch-changes in Elm 0.17.0
brianhicks
2
1.9k
State of Elm 2016
brianhicks
3
600
Mesos + Consul = Developer Happiness (JUG)
brianhicks
1
150
Other Decks in Technology
See All in Technology
SRE Next 2026 何でも屋からの脱却
bto
0
1k
Type-safe IaC for Dart
coborinai
0
160
実践!既存 Project への AI-Driven Development 適用〜 一ヶ月で Project 唯一のフロントエンドエンジニアを作り出せ〜
lycorptech_jp
PRO
0
250
変更し続けられるシステムをどう保つか — AI時代のSSoTという設計原則
kawauso
1
260
SRE本の知られざる名シーン / The Hidden Gems of Google SRE Book
nari_ex
2
430
AI時代のYAGNI:「爆速で無駄になった機能」からの学び / 20260720 Naoki Takahashi
shift_evolve
PRO
3
390
ガバナンスの「ちょうどいい落とし所」を探れ!開発スピードを妨げない運用判断の勘所 / SRE NEXT 2026
genda
1
260
データエンジニアリングとドメイン駆動設計
masuda220
PRO
4
210
最適な自走を最小限の支援で — M&Aで拡大する組織で少人数SREが挑んだ1年 / SRE NEXT 2026
genda
0
1.6k
DatabricksにおけるMCPソリューション
taka_aki
1
280
AI Coding Agent時代のcdk-nagガードレール 〜組織ルールを強制CIで守り抜く設計の挑戦〜
mhrtech
3
440
ソニー銀行におけるビジネスアジリティ向上のためのクラウドシフト戦略
srenext
0
860
Featured
See All Featured
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
400
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
KATA
mclloyd
PRO
35
15k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Prompt Engineering for Job Search
mfonobong
0
380
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
420
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
730
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.8k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Become a Pro
speakerdeck
PRO
31
6k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
990
Optimising Largest Contentful Paint
csswizardry
37
3.8k
Transcript
Make Snacks YET ANOTHER JAVASCRIPT BUILD SYSTEM
OUR APP ▸ Hello World As a Service ▸ .0001k
lines of JavaScript ▸ No build system !
# Makefile node_modules: package.json npm install touch -m $@
$ make node_modules npm install touch -m node_modules
. !"" Makefile !"" node_modules <- create or update this
#"" package.json <- whenever this changes
// src/hello.js module.exports = () => "hello"; // src/world.js module.exports
= function() { return "world"; }; // src/index.js import hello from "./hello"; import world from "./world"; console.log(hello() + " " + world());
. !"" Makefile !"" lib <- render ES5 here !""
node_modules !"" package.json #"" src <- from ESwhatever sources here !"" hello.js !"" index.js #"" world.js
SRC = $(wildcard src/*.js) LIB = $(SRC:src/%.js=lib/%.js) lib: $(LIB) lib/%.js:
src/%.js .babelrc node_modules mkdir -p $(@D) node_modules/.bin/babel $< -o $@
$ make lib/hello.js mkdir -p lib node_modules/.bin/babel src/hello.js -o lib/hello.js
// src/world.js module.exports = function() { return "world"; }; //
lib/world.js "use strict"; module.exports = function () { return "world"; };
// src/hello.js module.exports = () => "hello"; // lib/hello.js "use
strict"; module.exports = function () { return "hello"; };
// src/index.js import hello from "./hello"; import world from "./world";
console.log(hello() + " " + world());
// lib/index.js "use strict"; var _hello = require("./hello"); var _hello2
= _interopRequireDefault(_hello); var _world = require("./world"); var _world2 = _interopRequireDefault(_world); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } console.log((0, _hello2.default)() + " " + (0, _world2.default)());
. !"" Makefile !"" bundle.js <- make this !"" lib
<- by bundling these # !"" hello.js # !"" index.js # $"" world.js !"" node_modules !"" package.json $"" src <- which source from these !"" hello.js !"" index.js $"" world.js
bundle.js: $(LIB) node_modules/.bin/browserify lib/index.js > $@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require; if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot
find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}}; t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require; for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ "use strict"; module.exports = function () { return "hello"; }; },{}],2:[function(require,module,exports){ "use strict"; var _hello = require("./hello"); var _hello2 = _interopRequireDefault(_hello); var _world = require("./world"); var _world2 = _interopRequireDefault(_world); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } console.log((0, _hello2.default)() + " " + (0, _world2.default)()); },{"./hello":1,"./world":3}],3:[function(require,module,exports){ "use strict"; module.exports = function () { return "world"; }; },{}]},{},[2]);
bundle.js: $(LIB) node_modules/.bin/browserify lib/index.js | ./node_modules/.bin/prepack > $@
console.log("hello world");
THANK YOU I'M SO SORRY