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
160
Snake Snacks: Function Composition, The Dumb Way
brianhicks
0
180
State of Elm 2017
brianhicks
1
580
µ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
140
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
水を運ぶ人としてのリーダーシップ
izumii19
4
1k
スタートアップにAmazon EKSは早すぎる? マルチプロダクト戦略を加速する Platform Engineeringの実践 / Is Amazon EKS Too Soon for Startups? Practical Platform Engineering to Accelerate a Multi-Product Strategy
elmodev09
1
1.8k
AWS Security Agent といっしょに脅威モデリングをやってみよう
amarelo_n24
1
210
IaC コードを資産へ:AWS CDK 社内ライブラリと横断展開 / aws-summit-japan-2026
gotok365
10
1.6k
“詰む”前に仕組みを作れ 〜技術の波に溺れないためのキャッチアップ術〜
takasyou
7
3.9k
From Prompt Engineering to Loop Engineering
shibuiwilliam
1
240
元銀行員がAIだけでアプリを量産!「バイブコーディング実演セミナー 」
tatsuya1970
0
110
AIチャットの改善から見えた、良いAI体験とは / What Constitutes a Good AI Experience: Insights from Improving AI Chat
kubode
0
120
現場のトークンマネジメント
dak2
1
190
AIチャット検索改善の3週間
kworkdev
PRO
2
180
事業会社における 機械学習・推薦システム技術の活用事例と必要な能力 / ml-recsys-in-layerx-wantedly-2026
yuya4
0
160
Comment regagner la souveraineté de vos données tout en étant payé grâce à Nostr !
rlifchitz
0
200
Featured
See All Featured
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
260
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.8k
First, design no harm
axbom
PRO
2
1.2k
Agile that works and the tools we love
rasmusluckow
331
22k
Odyssey Design
rkendrick25
PRO
2
710
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
860
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
200
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
220
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Crafting Experiences
bethany
1
190
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