Skip to content

Commit 23c7b9f

Browse files
refactor: remove reloadAll option
1 parent d6736cc commit 23c7b9f

File tree

8 files changed

+3
-44
lines changed

8 files changed

+3
-44
lines changed

src/hmr/hotModuleReplacement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ module.exports = function (moduleId, options) {
216216
return;
217217
}
218218

219-
if (reloaded && !options.reloadAll) {
219+
if (reloaded) {
220220
console.log('[HMR] css reload %s', src.join(' '));
221221
} else {
222222
console.log('[HMR] Reload all css');

src/loader-options.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
},
1515
"esModule": {
1616
"type": "boolean"
17-
},
18-
"reloadAll": {
19-
"type": "boolean"
2017
}
2118
}
2219
}

test/HMR.test.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -126,31 +126,6 @@ describe('HMR', () => {
126126
}, 100);
127127
});
128128

129-
it('should reloads with reloadAll option', (done) => {
130-
const update = hotModuleReplacement('./src/style.css', {
131-
reloadAll: true,
132-
});
133-
134-
update();
135-
136-
setTimeout(() => {
137-
expect(console.log.mock.calls[0][0]).toMatchSnapshot();
138-
139-
const links = Array.prototype.slice.call(
140-
document.querySelectorAll('link')
141-
);
142-
143-
expect(links[0].visited).toBe(true);
144-
expect(document.head.innerHTML).toMatchSnapshot();
145-
146-
links[1].dispatchEvent(getLoadEvent());
147-
148-
expect(links[1].isLoaded).toBe(true);
149-
150-
done();
151-
}, 100);
152-
});
153-
154129
it('should reloads with non http/https link href', (done) => {
155130
document.head.innerHTML =
156131
'<link rel="stylesheet" href="/dist/main.css" /><link rel="shortcut icon" href="data:;base64,=" />';

test/__snapshots__/HMR.test.js.snap

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ exports[`HMR should reloads with non http/https link href 1`] = `"[HMR] css relo
2424
2525
exports[`HMR should reloads with non http/https link href 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\"><link rel=\\"shortcut icon\\" href=\\"data:;base64,=\\">"`;
2626
27-
exports[`HMR should reloads with reloadAll option 1`] = `"[HMR] Reload all css"`;
28-
29-
exports[`HMR should reloads with reloadAll option 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\">"`;
30-
3127
exports[`HMR should works 1`] = `"[HMR] css reload %s"`;
3228
3329
exports[`HMR should works 2`] = `"<link rel=\\"stylesheet\\" href=\\"/dist/main.css\\"><link rel=\\"stylesheet\\" href=\\"http://localhost/dist/main.css?1479427200000\\">"`;

test/__snapshots__/validate-loader-options.test.js.snap

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,3 @@ exports[`validate options should throw an error on the "publicPath" option with
1313
* options.publicPath should be a string.
1414
* options.publicPath should be an instance of function."
1515
`;
16-
17-
exports[`validate options should throw an error on the "reloadAll" option with "1" value 1`] = `
18-
"Invalid options object. Mini CSS Extract Plugin Loader has been initialized using an options object that does not match the API schema.
19-
- options.reloadAll should be a boolean."
20-
`;

test/cases/hmr/expected/webpack-4/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ module.exports = function (moduleId, options) {
10921092
return;
10931093
}
10941094

1095-
if (reloaded && !options.reloadAll) {
1095+
if (reloaded) {
10961096
console.log('[HMR] css reload %s', src.join(' '));
10971097
} else {
10981098
console.log('[HMR] Reload all css');

test/cases/hmr/expected/webpack-5/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ module.exports = function (moduleId, options) {
234234
return;
235235
}
236236

237-
if (reloaded && !options.reloadAll) {
237+
if (reloaded) {
238238
console.log('[HMR] css reload %s', src.join(' '));
239239
} else {
240240
console.log('[HMR] Reload all css');

test/validate-loader-options.test.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ describe('validate options', () => {
1010
success: [true, false],
1111
failure: [1],
1212
},
13-
reloadAll: {
14-
success: [true, false],
15-
failure: [1],
16-
},
1713
unknown: {
1814
success: [],
1915
// TODO failed in next release

0 commit comments

Comments
 (0)