Skip to content

Commit

Permalink
fix(client): set hot:false as a default
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroppy committed Apr 28, 2020
1 parent 0c74447 commit 5bf0372
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion client-src/default/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const status = {
currentHash: '',
};
const options = {
hot: true,
hot: false,
hotReload: true,
liveReload: false,
initial: true,
Expand All @@ -36,6 +36,7 @@ if (typeof window !== 'undefined') {

const onSocketMessage = {
hot() {
options.hot = true;
log.info('[WDS] Hot Module Replacement enabled.');
},
liveReload() {
Expand Down
2 changes: 1 addition & 1 deletion test/client/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports[`index should run onSocketMessage.ok 1`] = `"Ok"`;

exports[`index should run onSocketMessage.ok 2`] = `
Object {
"hot": true,
"hot": false,
"hotReload": true,
"initial": false,
"liveReload": false,
Expand Down
10 changes: 10 additions & 0 deletions test/e2e/TransportMode.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
initConsoleDelay,
awaitServerCloseDelay,
} = require('../helpers/puppeteer-constants');
const isWebpack5 = require('../helpers/isWebpack5');

describe('transportMode client', () => {
const modes = [
Expand Down Expand Up @@ -77,7 +78,16 @@ describe('transportMode client', () => {
res.splice(i, 1);
}
}

// TODO: delete this code when getting rid of webpack5
if (isWebpack5) {
const swap = res[0];
res[0] = res[1];
res[1] = swap;
}

expect(res).toMatchSnapshot();

done();
});
});
Expand Down
5 changes: 5 additions & 0 deletions test/helpers/isWebpack5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const webpack = require('webpack');

export default () => {
return webpack.version[0] === '5';
};

0 comments on commit 5bf0372

Please sign in to comment.