Skip to content

Commit 0904eb1

Browse files
authored
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
1 parent 734392e commit 0904eb1

File tree

1 file changed

+11
-25
lines changed

1 file changed

+11
-25
lines changed

content/guides/migrating.md

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -618,35 +618,21 @@ Loaders are now cacheable by default. Loaders must opt-out if they are not cache
618618

619619
### Complex options
620620

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.
623622

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.
625624

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.
627626

628-
`require("some-loader??by-ident!resource")`
629-
630-
``` js
627+
```diff
631628
{
632-
test: /.../,
633-
loader: "...",
634-
options: {
635-
ident: "by-ident",
636-
magic: () => return Math.random()
629+
test: /\.ext/
630+
use: {
631+
loader: '...',
632+
options: {
633+
- ident: 'id',
634+
fn: () => require('./foo.js')
635+
}
637636
}
638637
}
639638
```
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

Comments
 (0)