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
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
160
Other Decks in Technology
See All in Technology
【CEDEC2026】コードレビュー支援ツール開発から学ぶ:LLMを用いた業務システムの実践的な運用設計と誤出力対策
cygames
PRO
0
630
20260804_Q4AzureUpdateBite_FabricDataAgentの精度を高める設計.pdf
matayuuu
1
120
DatadogのBits Chatが開発組織にもたらしたもの / What Bits Chat Has Brought Us
sms_tech
1
130
AIコーディングの次。コードレビューと理解負荷を解消して組織の開発生産性を高める
moongift
PRO
2
2.3k
JavaScript 研修 (2026)
recruitengineers
PRO
2
470
Cursor Meetup Sapporo - Cursor物語 続編
cocacola917
0
140
Pavlokで始める電撃駆動開発
sgrsn
0
180
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.2k
【CEDEC2026】専門性の高いデフォルメチームが挑んだ人材育成戦略 〜Cygames Academiaの企画から実施まで〜
cygames
PRO
0
530
生成 AI の基礎 〜 サンプル実装で学ぶ基本原理
enakai00
7
4.4k
モノリス Rails でも日中に rails db:migrate を走らせたい! / Daytime rails db:migrate on Monolithic Rails!
euglena1215
4
550
【AG-UI × A2UI × MCP Apps】Generative UIをやさしく解説する
nrinetcom
PRO
1
100
Featured
See All Featured
New Earth Scene 8
popppiees
3
2.5k
The untapped power of vector embeddings
frankvandijk
2
1.8k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.6k
Heart Work Chapter 1 - Part 1
lfama
PRO
8
36k
Optimizing for Happiness
mojombo
378
71k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.5k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
540
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Designing Experiences People Love
moore
143
24k
Docker and Python
trallard
47
4.1k
How to Talk to Developers About Accessibility
jct
2
490
Site-Speed That Sticks
csswizardry
13
1.4k
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