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
pitch loaderについて
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
rchaser53
March 09, 2018
Programming
580
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
pitch loaderについて
rchaser53
March 09, 2018
More Decks by rchaser53
See All by rchaser53
LLVM IR入門
rchaser53
4
3k
Rustからwasmを生成してみた話
rchaser53
1
820
Base64 VLQ概要
rchaser53
2
1.7k
sourcemap規格概要
rchaser53
1
1.3k
TypeScript+React入門
rchaser53
1
910
Other Decks in Programming
See All in Programming
技術的負債の返済は、AI時代の複利で効く投資 — 経営としての意思決定とその遂行
curekoshimizu
1
2.3k
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
540
wkhtmltopdfの次どうするか問題2026
willnet
2
1.9k
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
130
golang-bob.pdf
iwatsukayura
0
120
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
250
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
110
Java 27新機能 / Java 27 new features
kishida
2
220
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.6k
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
480
カツオ、ご期待ください
suneo3476
0
160
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
200
Featured
See All Featured
Believing is Seeing
oripsolob
1
240
ラッコキーワード サービス紹介資料
rakko
1
5.3M
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
520
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.1k
Building Applications with DynamoDB
mza
96
7.2k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
920
The Pragmatic Product Professional
lauravandoore
37
7.5k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
Large-scale JavaScript Application Architecture
addyosmani
516
110k
Transcript
webpack のpitch loader について @rchaser53
webpack のpitch loader についてです cache-loader の調査中に気になったの調べました 自作、バグ修正の足がかりに役立てば幸いです
loader とは? いつものアレ(babel-loader とかcss-loader とか) module のソースコードを変換するもの 同期/ 非同期の両方に対応している loader
は任意のファイルを出力できる(file-loader とか)
loader の処理順 { test: '/.js$/', use: [ 'abc-loader', 'def-loader' ]
} 1. def-loader 2. abc-loader ではない正確にはpitch loader が先に実行される
pitch loader とは default loader の前に実行されるoptional なloader 値を返すとdefault loader まで処理が省略される
この時点ではまだソースは読み込まれていない
default loader の前に実行されるoptional なloader // webpack.config.js { test: '/.js$/', use:
[ 'abc-loader', 'def-loader' ] } 以下が正しい処理順 1. abc-loader -- pitch 2. def-loader -- pitch 3. (read the sources) 4. def-loader -- default 5. abc-loader -- default
default loader の前に実行されるoptional なloader dom のevent bubling からデザインされたもの
値を返すとdefault loader まで処理が省略される module.exports = { pitch: function() { //
値 返 default 処理 省略 // 返 値 String Buffer return 'something' // 非同期 // const callback = this.async(); // callback(null, 'something'); // return 何 返 (undefind) 次 loader 処理 移 } default: function(sources) { return sources[0] // Array 来 単純 return } }
値を返すとdefault loader まで処理が省略される 例1 abc-loader.pitch return "abc" def-loader.pitch ( 省略)
def-loader.loader ( 省略) abc-loader.loader ( 省略)
値を返すとdefault loader まで処理が省略される 例2 abc-loader pitch return def-loader pitch return
"somethingA" def-loader default ( 省略) abc-loader default return "somethingB"
値を返すとdefault loader まで処理が省略される 使用例 cache-loader 1. pitch loader でcache と依存ファイルのmtime
を比較 2. 差異がない場合はcache を読みこみreturn 3. defalult loader でそれまでの生成物と依存ファイルの path 、mtime からcache を作成
値を返すとdefault loader まで処理が省略される mtime … 最終変更時刻 (modify time) 最後にファイルを変更した時刻のこと 正確にはファイルにwrite(2)
、またはtruncate(2) した場合 に変更されるもの
この時点ではまだソースは読み込まれていない path は取得できるので取得はできる( 非推奨) loader-utils やschema-utils は使用できるのでoption など は取得できる 第3
引数経由で他のloader に値を渡すことはできる
この時点ではまだソースは読み込まれていない 正直cache-loader くらいしか第3 引数を使っている loader を見かけない cache の依存情報やfile がコンパイル中に変更されてい ないか確認するために使用している
そもそもpitch loader 自体ほとんど使われてない(script- loader, style-loader とか)
まとめ まとめ 使う機会はあるのか? webpack に対してはないかもしれない しかしフェイズを2 つに分けて、片方ではcache 管理な どを行うという設計の仕方は使えそう まぁその時楽しめれば良いよね
が作成できた! awesome-prettier-loader
参考リンク 公式ページ( かなり充実している) Documentation for pitch vs normal loader isn't
very clear UNIX/Linux の部屋 用語集: タイムスタンプ cache-loader
ご静聴ありがとうございました! ご静聴ありがとうございました!