1
1
[ ![ npm] [ npm ]] [ npm-url ]
2
+ [ ![ node] [ node ]] [ node-url ]
2
3
[ ![ deps] [ deps ]] [ deps-url ]
3
4
[ ![ test] [ test ]] [ test-url ]
4
5
[ ![ coverage] [ cover ]] [ cover-url ]
5
6
[ ![ chat] [ chat ]] [ chat-url ]
6
7
7
8
<div align =" center " >
8
9
<a href =" https://webpack.js.org/ " >
9
- <img width="200" height="200" vspace="" hspace="25" src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon-square-big.svg">
10
+ <img width="200" height="200" src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon-square-big.svg">
10
11
</a >
11
- <h1 >cache-loader </h1 >
12
- <p >Caches the result of following loaders on disk. </p >
12
+ <h1 >Cache Loader </h1 >
13
+ <p >Caches the result of following loaders on disk</p >
13
14
</div >
14
15
15
16
<h2 align =" center " >Install</h2 >
@@ -22,42 +23,75 @@ npm install --save-dev cache-loader
22
23
23
24
Add this loader in front of other (expensive) loaders to cache the result on disk.
24
25
25
- Note that there is an overhead for saving the reading and saving the cache file, so only use this loader to cache expensive loaders.
26
+ ** webpack.config.js**
27
+ ``` js
28
+ module .exports = {
29
+ module: {
30
+ rules: [
31
+ {
32
+ test: / \. ext$ / ,
33
+ use: [
34
+ ' cache-loader' ,
35
+ ... loaders
36
+ ],
37
+ include: path .resolve (' src' )
38
+ }
39
+ ]
40
+ }
41
+ }
42
+ ```
43
+
44
+ > ⚠️ Note that there is an overhead for saving the reading and saving the cache file, so only use this loader to cache expensive loaders.
45
+
46
+ <h2 align =" center " >Options</h2 >
47
+
48
+ | Name| Type| Default| Description|
49
+ | :--:| :--:| :-----:| :----------|
50
+ | ** ` cacheDirectory ` ** | ` {String} ` | ` path.resolve('.cache-loader') ` | Provide a cache directory where cache items should be stored|
26
51
27
52
<h2 align =" center " >Examples</h2 >
28
53
29
54
** webpack.config.js**
30
-
31
55
``` js
32
56
module .exports = {
33
57
module: {
34
58
rules: [
35
59
{
36
60
test: / \. js$ / ,
37
- include: path .resolve (" src" ),
38
61
use: [
39
- " cache-loader" ,
40
- " babel-loader"
41
- ]
62
+ ' cache-loader' ,
63
+ ' babel-loader'
64
+ ],
65
+ include: path .resolve (' src' )
42
66
}
43
67
]
44
68
}
45
69
}
46
70
```
47
71
48
- ** with options **
72
+ ### ` Options `
49
73
74
+ ** webpack.config.js**
50
75
``` js
51
- use: [
52
- {
53
- loader: " cache-loader" ,
54
- options: {
55
- // provide a cache directory where cache items should be stored
56
- cacheDirectory: path .resolve (" .cache" )
57
- }
58
- },
59
- " babel-loader"
60
- ]
76
+ module .exports = {
77
+ module: {
78
+ rules: [
79
+ {
80
+ test: / \. js$ / ,
81
+ use: [
82
+ {
83
+ loader: ' cache-loader' ,
84
+ options: {
85
+ cacheDirectory: path .resolve (' .cache' )
86
+ }
87
+ },
88
+ ' babel-loader'
89
+ ],
90
+ include: path .resolve (' src' )
91
+ }
92
+ ]
93
+ }
94
+ }
61
95
```
62
96
63
97
<h2 align =" center " >Maintainers</h2 >
@@ -69,16 +103,55 @@ use: [
69
103
<a href="https://github.com/sokra">
70
104
<img width="150" height="150" src="https://github.com/sokra.png?size=150">
71
105
</br>
72
- sokra
106
+ Tobias Koppers
107
+ </a>
108
+ </td>
109
+ <td align="center">
110
+ <a href="https://github.com/bebraw">
111
+ <img width="150" height="150" src="https://github.com/bebraw.png?v=3&s=150">
112
+ </br>
113
+ Juho Vepsäläinen
114
+ </a>
115
+ </td>
116
+ <td align="center">
117
+ <a href="https://github.com/d3viant0ne">
118
+ <img width="150" height="150" src="https://github.com/d3viant0ne.png?v=3&s=150">
119
+ </br>
120
+ Joshua Wiens
121
+ </a>
122
+ </td>
123
+ <td align="center">
124
+ <a href="https://github.com/sapegin">
125
+ <img width="150" height="150" src="https://github.com/sapegin.png?v=3&s=150">
126
+ </br>
127
+ Artem Sapegin
128
+ </a>
129
+ </td>
130
+ <td align="center">
131
+ <a href="https://github.com/michael-ciniawsky">
132
+ <img width="150" height="150" src="https://github.com/michael-ciniawsky.png?v=3&s=150">
133
+ </br>
134
+ Michael Ciniawsky
135
+ </a>
136
+ </td>
137
+ <td align="center">
138
+ <a href="https://github.com/evilebottnawi">
139
+ <img width="150" height="150" src="https://github.com/evilebottnawi.png?v=3&s=150">
140
+ </br>
141
+ Alexander Krasnoyarov
73
142
</a>
74
143
</td>
75
144
</tr>
76
145
<tbody >
77
146
</table >
78
147
148
+
79
149
[ npm ] : https://img.shields.io/npm/v/cache-loader.svg
80
150
[ npm-url ] : https://npmjs.com/package/cache-loader
81
151
152
+ [ node ] : https://img.shields.io/node/v/cache-loader.svg
153
+ [ node-url ] : https://nodejs.org
154
+
82
155
[ deps ] : https://david-dm.org/webpack-contrib/cache-loader.svg
83
156
[ deps-url ] : https://david-dm.org/webpack-contrib/cache-loader
84
157
0 commit comments