Skip to content

Commit

Permalink
Merge branch 'next' into feat/env
Browse files Browse the repository at this point in the history
  • Loading branch information
anshumanv committed May 30, 2020
2 parents f0fbc09 + 528e926 commit e6a5b51
Show file tree
Hide file tree
Showing 3 changed files with 611 additions and 501 deletions.
25 changes: 25 additions & 0 deletions packages/webpack-cli/__tests__/AdvancedGroup.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const AdvancedGroup = require('../lib/groups/AdvancedGroup');

describe('AdvancedGroup', function () {
it('should load the HMR Plugin', () => {
const group = new AdvancedGroup([
{
hot: true,
},
]);

const result = group.run();
expect(result.options.plugins[0].constructor.name).toEqual('HotModuleReplacementPlugin');
});

it('should load the Prefetch Plugin', () => {
const group = new AdvancedGroup([
{
prefetch: 'url',
},
]);

const result = group.run();
expect(result.options.plugins[0].constructor.name).toEqual('PrefetchPlugin');
});
});
3 changes: 1 addition & 2 deletions packages/webpack-cli/lib/groups/AdvancedGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ class AdvancedGroup extends GroupHelper {
if (options && options.plugins) {
options.plugins.unshift(prefetchVal);
} else {
// Currently the Plugin function is not functional -> https://github.com/webpack/webpack-cli/pull/1140#discussion_r376761359
// options.plugins = [prefetchVal];
options.plugins = [prefetchVal];
}
}
if (args.target) {
Expand Down
Loading

0 comments on commit e6a5b51

Please sign in to comment.