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
Copy file name to clipboardExpand all lines: content/guides/migrating.md
+49Lines changed: 49 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -230,6 +230,55 @@ See [CLI](/api/cli).
230
230
231
231
These functions are now always asynchronous instead of calling their callback sync if the chunk is already loaded.
232
232
233
+
## Loader configuration is through `options`
234
+
235
+
You can *no longer* configure a loader with a custom property in the `webpack.config.js`. It must be done through the `options`. The following configuration with the `ts` property is no longer valid with webpack 2:
236
+
237
+
```js
238
+
module.exports= {
239
+
...
240
+
module: {
241
+
use: [{
242
+
test:/\.tsx?$/,
243
+
loader:'ts-loader'
244
+
}]
245
+
},
246
+
// does not work with webpack 2
247
+
ts: { transpileOnly:false }
248
+
}
249
+
```
250
+
251
+
### What is options?
252
+
253
+
Good question. Well, strictly speaking it's 2 possible things; both ways to configure a webpack loader. Classically `options` was called `query` and was a string which could be appended to the name of the loader. Much like a query string but actually with [greater powers](https://github.com/webpack/loader-utils#parsequery):
But it can also be a separately specified object that's supplied alongside a loader:
268
+
269
+
```js
270
+
module.exports= {
271
+
...
272
+
module: {
273
+
use: [{
274
+
test:/\.tsx?$/,
275
+
loader:'ts-loader'
276
+
options: { transpileOnly:false }
277
+
}]
278
+
}
279
+
}
280
+
```
281
+
233
282
## `LoaderOptionsPlugin` context
234
283
235
284
Some loaders need context information and read them from the configuration. This need to be passed via loader options in long-term. See loader documentation for relevant options.
0 commit comments