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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
最適な自走を最小限の支援で — M&Aで拡大する組織で少人数SREが挑んだ1年 / SRE NEXT 2026
genda
0
1.6k
ガバナンスの「ちょうどいい落とし所」を探れ!開発スピードを妨げない運用判断の勘所 / SRE NEXT 2026
genda
1
260
LLMやAIエージェントをソフトウェアに組み込むプラクティス
shibuiwilliam
2
430
AI Coding Agent時代のcdk-nagガードレール 〜組織ルールを強制CIで守り抜く設計の挑戦〜
mhrtech
3
440
SRE Next 2026 何でも屋からの脱却
bto
0
1k
インフラと開発の垣根を超えていき!〜元AWSインフラエンジニアがAWS開発で奮闘している話〜
hatahata021
3
300
Gen3R: 3D Scene Generation Meets Feed-Forward Reconstruction
spatial_ai_network
0
140
Network Firewallやっていき!
news_it_enj
0
170
データエンジニアリングとドメイン駆動設計
masuda220
PRO
4
200
仕様駆動開発、導入半年。「本当に速くなってるの?」にデータで答える / AICon2026_hirakawa
rakus_dev
0
150
Alphaモジュール使っていいのかい!?いけないのかい!?どっちなんだいっ!?
watany
1
290
Data + AI Summit 2026 イベントレポート: 「AIがビジネスで意思決定するデータ基盤」へ
nek0128
0
290
Featured
See All Featured
Code Review Best Practice
trishagee
74
20k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
450
Writing Fast Ruby
sferik
630
63k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
640
Designing Experiences People Love
moore
143
24k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
410
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
360
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Agile that works and the tools we love
rasmusluckow
331
22k
Making the Leap to Tech Lead
cromwellryan
135
10k
Become a Pro
speakerdeck
PRO
31
6k
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