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
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
2.9k
Rustからwasmを生成してみた話
rchaser53
1
820
Base64 VLQ概要
rchaser53
2
1.7k
sourcemap規格概要
rchaser53
1
1.2k
TypeScript+React入門
rchaser53
1
910
Other Decks in Programming
See All in Programming
wkhtmltopdfの次どうするか問題2026
willnet
2
1.6k
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
150
個人開発基盤をまるごとCloudflareに引っ越して爆速で総合的体験を向上させた話
tinykitten
0
200
Webの地図
yosuke_furukawa
PRO
6
4.7k
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
790
Security issues being discussed on Web Platforms
petamoriken
0
1k
Jetpack Compose メカニズム
skydoves
0
450
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
450
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
410
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
260
速習iPhone Duo対応
yuukiw00w
1
690
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
7.9k
Featured
See All Featured
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
460
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Utilizing Notion as your number one productivity tool
mfonobong
4
590
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
550
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
710
Making Projects Easy
brettharned
120
6.8k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
320
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
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
ご静聴ありがとうございました! ご静聴ありがとうございました!