Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Browserify, beyond differences of node and web
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
wtnabe
August 29, 2015
Programming
920
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Browserify, beyond differences of node and web
Kanazawa.rb meetup #36で喋ったBrowserifyの紹介と今後もJavaScriptを利用するに当たって押さえておくべき課題のまとめ
wtnabe
August 29, 2015
More Decks by wtnabe
See All by wtnabe
新しいフロントプロセスとドキュメントフォーマットを考えてみた
wtnabe
0
48
Rubyでもモノリポしたい - 調査、おさわり編 -
wtnabe
0
80
Ruby de Railway Oriented Programming
wtnabe
0
130
Bindanのススメ
wtnabe
0
75
そのオブジェクト、何を保証してくれますか? - GuideRailのススメ -
wtnabe
0
84
Effective Jekyll
wtnabe
0
110
5 min Jekyll/Liquid Plugin cooking
wtnabe
0
74
Ruby de Wasm
wtnabe
0
110
Cloud Native Buildpacksって結局どうなの?
wtnabe
0
93
Other Decks in Programming
See All in Programming
Agents on Rails - Rails at Scale 2026
irinanazarova
0
330
Simple Storage Service(S3) is not simple
iwatsukayura
0
190
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
390
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
290
スマートフォンでモールス信号を送受信する 〜スマートフォンのLEDとカメラで作る光通信の設計と実装〜
atsuki_seo
0
230
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
340
APNsからLive Activityを開始する話
yumnumm
0
150
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
310
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
160
カツオ、ご期待ください
suneo3476
0
140
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
130
残高管理から台帳サービスへの進化
artoy
0
140
Featured
See All Featured
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
450
Bash Introduction
62gerente
615
220k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
310
Design in an AI World
tapps
1
350
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Technical Leadership for Architectural Decision Making
baasie
3
590
A designer walks into a library…
pauljervisheath
211
25k
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Transcript
BrowserifyでNode.jsとWebの いいとこどりJS開発 〜 今、ちょい先、だいぶ先まで⾒すえて 〜 @wtnabe Kanazawa.rb meetup #36 2015-08-29
(Sat) at IT-Plaza MUSASHI
お品書き そもそも Ecma262 は ⼀⽅ Node.js は そこで Browserify ですよ
Browserify の特徴から⾒える我々の課題
最初にまとめ
Browserifyにできること require をブラウザ上で動くように変換 変換後は1つの JS ファイルに結合 その他移植可能なモジュールの提供 transform, plugin による拡張
Here, we go !!
そもそもEcma262は
依存コードを取得できない プラットフォーム独⽴ ⾔語⾃⾝にファイル読み込みがない FileSystemを持つJScriptですらwsfファイ ルで<script>を使う
スコープはfunctionのみ ファイルを分割しても影響は全体に うっかり var を忘れると global leak
「テクニック」が横⾏ 利⽤機会が増えてお互いに影響が出るとまずい (function() { ... })(); ※ testability が激しく落ちるデメリット
⼀⽅Node.jsは
責務の単位でファイル分割 ファイル単位スコープ 必要なものは require module.exports 公開するものを明⽰ そのうえで名前空間不可侵
node_modules 依存モジュールは閉じてる 個々のモジュール内にnode_modules 全体のコンフリクトが存在しない
スケールする依存管理 ※ 代わりに容量は膨らむ
安⼼して開発を進められる
そこでBrowserifyですよ
Browserifyにできること Node.js の require がブラウザ上で動く 変換後は1つの JS ファイルに結合 その他移植可能なモジュールの提供 transform,
plugin による拡張
requireが動く 依存ツリーを解決 1つの JavaScript ファイルを出⼒ ファイル単位のスコープ分割が⾃動的に ⾏われる 例のテクニック + α
何が嬉しいのか? スコープ管理⽤のテクニック不要 豊富な npm module 群の⼀部を活⽤可能 <script> を書き連ねる必要なし
そしてtransformの例 coffeeify ( CoffeeScript ) cssify ( CSS ) babelify
( Babel : ES6 & JSX ) espowerify ( power-assert ) cf. list of transforms · substack/node-browserify Wiki
ローダーとの⽐較 LABjs ブラウザのみ対応、⾮同期読み込み RequireJS ブラウザも node.js も対応している が、それぞれ書き⽅が違う ※ 要
LAB.js, require.js
Browserifyの特徴から ⾒える我々の課題
その1 : npm JSer の知⾒は以前にも増して npm に集約 されつつある download して
<script> とかやらない package.json は多機能、タスクランナーと か⾔う前にマニュアル読め
その2 : transpiler source-to-source compiler transcompiler / transpiler JavaScript の変換は
altJS に限らず常識に JSX とか 変換⽅法はいくつかあるが、⾃分たちに合うものを⾒つけておく
その3: source map 変換された JS と元のコードの対応付け Browserify は debug オプションだけで
data uri の source map を⽣成してくれる
その4 : preprocess preprocess で trans compile できるなら新 しいチャレンジはやりやすい ES6,
JSX, ... preprocess の⾃動化で学習、業務効率に 差がつく
Browserify以外では View, DOMの新しい動き JSX系の記法、VirtualDOM フルスタックフレームワーク vs Tools ※ ツールの話をしてるけどツールの話だけ追うのはよくない
その先の課題
EcmaScript 2015 将来はこれ HTML 5 に突っ込むよりは確実 今から慣れるという意味では Babel 重要 先んずれば⼈を制す
Enjoy !!
参考 Browserify substack/browserify-handbook studiomohawk/browserify-handbook list of transforms · substack/node-browserify Wiki
参考 Effective ES6 ECMAScript 2015 Language Specification – ECMA-262 6th
Edition Babel · The compiler for writing next generation JavaScript