You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If `true`, it will not allow extension-less files. So by default `require('./foo')` works if `./foo` has a `.js` extension, but with this enabled only `require('./foo.js')` will work. Default:
107
112
108
-
If false it will also try to use no extension from above.
113
+
```js
114
+
enforceExtension:false
115
+
```
109
116
110
117
111
118
## `resolve.enforceModuleExtension`
112
119
113
-
`bool`
120
+
`boolean`
114
121
115
-
Default:`false`
122
+
Whether to require to use an extension for modules (e.g. loaders). Default:
116
123
117
-
If false it's also try to use no module extension from above.
124
+
```js
125
+
enforceModuleExtension:false
126
+
```
118
127
119
128
120
129
## `resolve.extensions`
@@ -124,7 +133,7 @@ If false it's also try to use no module extension from above.
124
133
Automatically resolve certain extensions. This defaults to:
125
134
126
135
```js
127
-
extensions: [".js", ".json"]
136
+
extensions: [".js", ".json"]
128
137
```
129
138
130
139
which is what enables users to leave off the extension when importing:
@@ -174,9 +183,11 @@ This means that when we `import * as D3 from "d3"` this will really resolve to t
174
183
175
184
`array`
176
185
177
-
Default:`["index"]`
186
+
The filename to be used while resolving directories. Default:
178
187
179
-
The filename to be used while resolving directories.
If `true`, trying to resolve a context to its absolute path ends when a directory is found. Default:
212
223
213
-
If true, trying to resolve a context to its absolute path ends when a directory is found.
224
+
```js
225
+
resolveToContext:false
226
+
```
214
227
215
228
216
229
## `resolve.unsafeCache`
217
230
218
231
`regex``array``boolean`
219
232
220
-
Enable aggressive, but **unsafe**, caching of modules. Passing `true` will cache everything. A regular expression, or an array of regular expressions, can be used to test file paths and only cache certain modules. For example, to only cache utilities:
233
+
Enable aggressive, but **unsafe**, caching of modules. Passing `true` will cache everything. Default:
234
+
235
+
```js
236
+
unsafeCache:true
237
+
```
238
+
239
+
A regular expression, or an array of regular expressions, can be used to test file paths and only cache certain modules. For example, to only cache utilities:
221
240
222
241
```js
223
242
unsafeCache:/src\/utilities/
@@ -230,9 +249,7 @@ W> Changes to cached paths may cause failure in rare cases.
230
249
231
250
`object`
232
251
233
-
This set of options is identical to the `resolve` set above, but is used only to resolve webpack's [loader](/concepts/loaders) packages.
234
-
235
-
Default:
252
+
This set of options is identical to the `resolve` set above, but is used only to resolve webpack's [loader](/concepts/loaders) packages. Default:
236
253
237
254
```js
238
255
{
@@ -244,32 +261,46 @@ Default:
244
261
245
262
T> Note that you can use alias here and other features familiar from resolve. For example `{ txt: 'raw-loader' }` would shim `txt!templates/demo.txt` to use `raw-loader`.
246
263
247
-
## `resolveLoader.moduleTemplates`
264
+
265
+
## `resolveLoader.moduleExtensions`
248
266
249
267
`array`
250
268
251
-
That's a `resolveLoader` only property.It describes alternatives for the module name that are tried.
269
+
The extensions which are tried when resolving a module (e.g. loaders). By default this is an empty array.
If you want to use loaders without the `-loader` suffix, you can use this:
254
272
273
+
```js
274
+
moduleExtensions: ['-loaders']
275
+
```
255
276
256
-
## `resolveLoader.moduleExtensions`
257
277
258
-
`array`
278
+
## `resolve.plugins`
259
279
260
-
Example: `['-loaders']`
280
+
A list of additional resolve plugins which should be applied. It allows plugins such as [`DirectoryNamedWebpackPlugin`](https://www.npmjs.com/package/directory-named-webpack-plugin).
261
281
262
-
These extensions which are tried when resolving a module.
282
+
```js
283
+
plugins: [newDirectoryNamedWebpackPlugin()]
284
+
```
263
285
264
286
265
-
## `resolve.plugins`
287
+
## `resolve.symlinks`
266
288
267
-
?> Description
289
+
`boolean`
268
290
269
-
## `resolve.symlinks`
291
+
Whether to resolve symlinks to their symlinked location. Default:
292
+
293
+
```js
294
+
symlinks:true
295
+
```
270
296
271
-
?> Description
272
297
273
298
## `resolve.cachePredicate`
274
299
275
-
?> Description
300
+
`function`
301
+
302
+
A function which decides whether a request should be cached or not. An object is passed to the function with `path` and `request` properties. Default:
0 commit comments