Skip to content

Commit 53f678d

Browse files
feat: remove the ident property from loader options (#446)
1 parent a043922 commit 53f678d

File tree

7 files changed

+1
-43
lines changed

7 files changed

+1
-43
lines changed

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ module.exports = {
309309
test: /\.css$/i,
310310
loader: 'postcss-loader',
311311
options: {
312-
ident: 'postcss',
313312
plugins: (loader) => [
314313
require('postcss-import')({ root: loader.resourcePath }),
315314
require('postcss-preset-env')(),
@@ -322,8 +321,6 @@ module.exports = {
322321
};
323322
```
324323

325-
> ⚠️ webpack requires an identifier (`ident`) in `options` when `{Function}/require` is used (Complex Options). The `ident` can be freely named as long as it is unique. It's recommended to name it (`ident: 'postcss'`)
326-
327324
**`webpack.config.js`**
328325

329326
```js
@@ -334,7 +331,6 @@ module.exports = {
334331
test: /\.css$/i,
335332
loader: 'postcss-loader',
336333
options: {
337-
ident: 'postcss',
338334
plugins: {
339335
'postcss-import': {},
340336
'postcss-nested': {},
@@ -371,7 +367,6 @@ module.exports = {
371367
test: /\.css$/i,
372368
loader: 'postcss-loader',
373369
options: {
374-
ident: 'postcss',
375370
plugins: {
376371
'postcss-import': {},
377372
'postcss-nested': {},
@@ -586,7 +581,7 @@ module.exports = {
586581
### `SourceMap`
587582

588583
Type: `Boolean|String`
589-
Default: `undefined`
584+
Default: `compiler.devtool`
590585

591586
By default generation of source maps depends on the devtool option.
592587
All values enable source map generation except eval and false value.
@@ -667,7 +662,6 @@ module.exports = {
667662
{
668663
loader: 'postcss-loader',
669664
options: {
670-
ident: 'postcss',
671665
plugins: [require('postcss-import')(), require('stylelint')()],
672666
},
673667
},
@@ -694,7 +688,6 @@ module.exports = {
694688
{
695689
loader: 'postcss-loader',
696690
options: {
697-
ident: 'postcss',
698691
plugins: [require('autoprefixer')({ ...options })],
699692
},
700693
},

test/options/__snapshots__/config.test.js.snap

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,6 @@ exports[`Config Options should work Config - {Object}: errors 1`] = `Array []`;
5454

5555
exports[`Config Options should work Config - {Object}: warnings 1`] = `Array []`;
5656

57-
exports[`Config Options should work Config - Context - {Object} - with ident: css 1`] = `
58-
"a { color: rgba(255, 0, 0, 1.0) }
59-
"
60-
`;
61-
62-
exports[`Config Options should work Config - Context - {Object} - with ident: errors 1`] = `Array []`;
63-
64-
exports[`Config Options should work Config - Context - {Object} - with ident: warnings 1`] = `Array []`;
65-
6657
exports[`Config Options should work Config - Context - {Object}: css 1`] = `
6758
"a { color: rgba(255, 0, 0, 1.0) }
6859
"

test/options/config.test.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -131,23 +131,6 @@ describe('Config Options', () => {
131131
expect(getErrors(stats)).toMatchSnapshot('errors');
132132
});
133133

134-
it('should work Config - Context - {Object} - with ident', async () => {
135-
const compiler = getCompiler('./css/index.js', {
136-
ident: 'postcss',
137-
config: {
138-
path: 'test/fixtures/config/postcss.config.js',
139-
ctx: { plugin: true },
140-
},
141-
});
142-
const stats = await compile(compiler);
143-
144-
const codeFromBundle = getCodeFromBundle('style.css', stats);
145-
146-
expect(codeFromBundle.css).toMatchSnapshot('css');
147-
expect(getWarnings(stats)).toMatchSnapshot('warnings');
148-
expect(getErrors(stats)).toMatchSnapshot('errors');
149-
});
150-
151134
it('should work Config – Context – Loader {Object}', async () => {
152135
const compiler = getCompiler('./css/index.js', {
153136
config: {

test/options/parser.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ describe('Options Parser', () => {
6060
loader: path.resolve(__dirname, '../../src'),
6161
// eslint-disable-next-line global-require
6262
options: {
63-
ident: 'postcss',
6463
// eslint-disable-next-line global-require,import/no-dynamic-require
6564
parser: require('sugarss'),
6665
config: false,
@@ -99,7 +98,6 @@ describe('Options Parser', () => {
9998
loader: path.resolve(__dirname, '../../src'),
10099
// eslint-disable-next-line global-require
101100
options: {
102-
ident: 'postcss',
103101
// eslint-disable-next-line global-require,import/no-dynamic-require
104102
parser: require('sugarss').parse,
105103
config: false,

test/options/plugins.test.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
describe('Options Plugins', () => {
1010
it('should work Plugins - {Array}', async () => {
1111
const compiler = getCompiler('./css/index.js', {
12-
ident: 'postcss',
1312
// eslint-disable-next-line global-require
1413
plugins: [require('../fixtures/config/plugin')()],
1514
});
@@ -24,7 +23,6 @@ describe('Options Plugins', () => {
2423

2524
it('should work Plugins - {Object}', async () => {
2625
const compiler = getCompiler('./css/index.js', {
27-
ident: 'postcss',
2826
// eslint-disable-next-line global-require
2927
plugins: require('../fixtures/config/plugin'),
3028
});
@@ -39,7 +37,6 @@ describe('Options Plugins', () => {
3937

4038
it('should work Plugins - {Function} - {Array}', async () => {
4139
const compiler = getCompiler('./css/index.js', {
42-
ident: 'postcss',
4340
// eslint-disable-next-line global-require
4441
plugins: () => [require('../fixtures/config/plugin')()],
4542
});
@@ -54,7 +51,6 @@ describe('Options Plugins', () => {
5451

5552
it('should work Plugins - {Function} - {Object}', async () => {
5653
const compiler = getCompiler('./css/index.js', {
57-
ident: 'postcss',
5854
// eslint-disable-next-line global-require
5955
plugins: () => require('../fixtures/config/plugin')(),
6056
});

test/options/stringifier.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ describe('Options Stringifier', () => {
2323

2424
it('should work Stringifier - {Object}', async () => {
2525
const compiler = getCompiler('./css/index.js', {
26-
ident: 'postcss',
2726
// eslint-disable-next-line global-require
2827
stringifier: require('sugarss'),
2928
config: false,
@@ -58,7 +57,6 @@ describe('Options Stringifier', () => {
5857

5958
it('should emit error Stringifier', async () => {
6059
const compiler = getCompiler('./css/index.js', {
61-
ident: 'postcss',
6260
// eslint-disable-next-line global-require
6361
stringifier: 'unresolved',
6462
config: false,

test/options/syntax.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ describe('Options Syntax', () => {
5959
{
6060
loader: path.resolve(__dirname, '../../src'),
6161
options: {
62-
ident: 'postcss',
6362
// eslint-disable-next-line global-require
6463
syntax: require('sugarss'),
6564
config: false,

0 commit comments

Comments
 (0)