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
@@ -621,7 +621,7 @@ When the `mode` option is not specified in the configuration, you can use the `-
621
621
622
622
If your configuration exports a function, the value of `--config-node-env` is assigned to mode after the function returns. This means that `mode` will not be available in the function arguments (`env` and `argv`). However, the value of `--config-node-env` is accessible as `argv.nodeEnv` within the function and can be used accordingly.
623
623
624
-
```javascript
624
+
```js
625
625
exportdefault (env, argv) => {
626
626
console.log(argv.defineProcessEnvNodeEnv); // 'production' if --config-node-env production is used
@@ -113,7 +113,7 @@ By default, the resource file is converted to a UTF-8 string and passed to the l
113
113
114
114
**raw-loader.js**
115
115
116
-
```javascript
116
+
```js
117
117
exportdefaultfunctionrawLoader(content) {
118
118
assert(content instanceof Buffer);
119
119
returnsomeSyncOperation(content);
@@ -131,7 +131,7 @@ T> Loaders may be added inline in requests and disabled via inline prefixes, whi
131
131
132
132
For the following configuration of [`use`](/configuration/module/#ruleuse):
133
133
134
-
```javascript
134
+
```js
135
135
exportdefault {
136
136
// ...
137
137
module: {
@@ -161,7 +161,7 @@ So why might a loader take advantage of the "pitching" phase?
161
161
162
162
First, the `data` passed to the `pitch` method is exposed in the execution phase as well under `this.data` and could be useful for capturing and sharing information from earlier in the cycle.
@@ -173,7 +173,7 @@ export function pitch(remainingRequest, precedingRequest, data) {
173
173
174
174
Second, if a loader delivers a result in the `pitch` method, the process turns around and skips the remaining loaders. In our example above, if the `b-loader`s `pitch` method returned something:
175
175
176
-
```javascript
176
+
```js
177
177
exportdefaultfunctionmyLoaderName(content) {
178
178
returnsomeSyncOperation(content);
179
179
}
@@ -203,21 +203,21 @@ Given the following example, this require call is used:
203
203
204
204
In `/abc/file.js`:
205
205
206
-
```javascript
206
+
```js
207
207
import"./loader1?xyz!loader2!./resource?rrr";
208
208
```
209
209
210
210
### this.addContextDependency
211
211
212
-
```typescript
212
+
```ts
213
213
addContextDependency(directory: string)
214
214
```
215
215
216
216
Add a directory as dependency of the loader result.
217
217
218
218
### this.addDependency
219
219
220
-
```typescript
220
+
```ts
221
221
addDependency(file: string)
222
222
dependency(file: string) // shortcut
223
223
```
@@ -226,7 +226,7 @@ Add an existing file as a dependency of the loader result in order to make them
226
226
227
227
### this.addMissingDependency
228
228
229
-
```typescript
229
+
```ts
230
230
addMissingDependency(file: string)
231
231
```
232
232
@@ -240,7 +240,7 @@ Tells the [loader-runner](https://github.com/webpack/loader-runner) that the loa
240
240
241
241
A function that sets the cacheable flag:
242
242
243
-
```typescript
243
+
```ts
244
244
cacheable(flag=true: boolean)
245
245
```
246
246
@@ -272,7 +272,7 @@ In case this function is called, you should return undefined to avoid ambiguous
272
272
273
273
### this.clearDependencies
274
274
275
-
```typescript
275
+
```ts
276
276
clearDependencies();
277
277
```
278
278
@@ -290,7 +290,7 @@ A data object shared between the pitch and the normal phase.
290
290
291
291
### this.emitError
292
292
293
-
```typescript
293
+
```ts
294
294
emitError(error: Error)
295
295
```
296
296
@@ -307,15 +307,15 @@ T> Unlike throwing an Error directly, it will NOT interrupt the compilation proc
0 commit comments