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
fix(guides): remove ident section from the migration guide
Added a warning instead that points to the v2 version in which this option
became obsolete. We could also reference an older version of the docs if
necessary for people to jump back to, though that may be overkill.
Fixes#1150
Copy file name to clipboardExpand all lines: content/guides/migrating.md
+11-25Lines changed: 11 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -618,35 +618,21 @@ Loaders are now cacheable by default. Loaders must opt-out if they are not cache
618
618
619
619
### Complex options
620
620
621
-
webpack 1 only supports `JSON.stringify`-able options for loaders.
622
-
webpack 2 now supports any JS object as loader options.
621
+
__webpack v1__ only supports `JSON.stringify`-able options for loaders.
623
622
624
-
Using complex options comes with one restriction. You may need to have a `ident` for the option object to make it referenceable by other loaders.
623
+
__webpack v2__ now supports any JS object as loader options.
625
624
626
-
Having an `ident`on the options object means to be able to reference this options object in inline loaders. Here is an example:
625
+
Before [v2.2.1](https://github.com/webpack/webpack/releases/tag/v2.2.1) (i.e. from v2.0.0 through v2.2.0), using complex options required using `ident`for the `options` object to allow its reference from other loaders. __This was removed in v2.2.1__ and thus current migrations do not require any use of the `ident` key.
627
626
628
-
`require("some-loader??by-ident!resource")`
629
-
630
-
```js
627
+
```diff
631
628
{
632
-
test:/.../,
633
-
loader:"...",
634
-
options: {
635
-
ident:"by-ident",
636
-
magic: () =>returnMath.random()
629
+
test: /\.ext/
630
+
use: {
631
+
loader: '...',
632
+
options: {
633
+
- ident: 'id',
634
+
fn: () => require('./foo.js')
635
+
}
637
636
}
638
637
}
639
638
```
640
-
641
-
This inline style should not be used by regular code, but it's often used by loader generated code.
642
-
I. e. the `style-loader` generates a module that `require`s the remaining request (which exports the CSS).
643
-
644
-
```js
645
-
// style-loader generated code (simplified)
646
-
var addStyle =require("./add-style");
647
-
var css =require("-!css-loader?{"modules":true}!postcss-loader??postcss-ident");
648
-
649
-
addStyle(css);
650
-
```
651
-
652
-
So if you use complex options tell your users about the `ident`.
0 commit comments