Skip to content

Commit a75dc8b

Browse files
authoredSep 19, 2020
fix: related asset info
1 parent 4103571 commit a75dc8b

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed
 

‎src/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,8 @@ class TerserPlugin {
457457
if (extractedCommentsSource) {
458458
const { commentsFilename } = output;
459459

460-
newInfo.related = { license: commentsFilename };
460+
// TODO `...` required only for webpack@4
461+
newInfo.related = { license: commentsFilename, ...info.related };
461462

462463
allExtractedComments.set(name, {
463464
extractedCommentsSource,

‎test/TerserPlugin.test.js

+20-20
Original file line numberDiff line numberDiff line change
@@ -946,8 +946,8 @@ describe('TerserPlugin', () => {
946946
}
947947

948948
expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
949-
expect(getWarnings(stats)).toMatchSnapshot('errors');
950-
expect(getErrors(stats)).toMatchSnapshot('warnings');
949+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
950+
expect(getErrors(stats)).toMatchSnapshot('errors');
951951

952952
await new Promise(async (resolve) => {
953953
const newStats = await compile(compiler);
@@ -1007,8 +1007,8 @@ describe('TerserPlugin', () => {
10071007
}
10081008

10091009
expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
1010-
expect(getWarnings(stats)).toMatchSnapshot('errors');
1011-
expect(getErrors(stats)).toMatchSnapshot('warnings');
1010+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
1011+
expect(getErrors(stats)).toMatchSnapshot('errors');
10121012

10131013
await new Promise(async (resolve) => {
10141014
const newStats = await compile(compiler);
@@ -1068,8 +1068,8 @@ describe('TerserPlugin', () => {
10681068
}
10691069

10701070
expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
1071-
expect(getWarnings(stats)).toMatchSnapshot('errors');
1072-
expect(getErrors(stats)).toMatchSnapshot('warnings');
1071+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
1072+
expect(getErrors(stats)).toMatchSnapshot('errors');
10731073

10741074
new ModifyExistingAsset({ name: 'js.js' }).apply(compiler);
10751075

@@ -1132,8 +1132,8 @@ describe('TerserPlugin', () => {
11321132
}
11331133

11341134
expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
1135-
expect(getWarnings(stats)).toMatchSnapshot('errors');
1136-
expect(getErrors(stats)).toMatchSnapshot('warnings');
1135+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
1136+
expect(getErrors(stats)).toMatchSnapshot('errors');
11371137

11381138
await new Promise(async (resolve) => {
11391139
const newStats = await compile(compiler);
@@ -1194,8 +1194,8 @@ describe('TerserPlugin', () => {
11941194
}
11951195

11961196
expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
1197-
expect(getWarnings(stats)).toMatchSnapshot('errors');
1198-
expect(getErrors(stats)).toMatchSnapshot('warnings');
1197+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
1198+
expect(getErrors(stats)).toMatchSnapshot('errors');
11991199

12001200
new ModifyExistingAsset({ name: 'js.js' }).apply(compiler);
12011201

@@ -1251,8 +1251,8 @@ describe('TerserPlugin', () => {
12511251
}
12521252

12531253
expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
1254-
expect(getWarnings(stats)).toMatchSnapshot('errors');
1255-
expect(getErrors(stats)).toMatchSnapshot('warnings');
1254+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
1255+
expect(getErrors(stats)).toMatchSnapshot('errors');
12561256

12571257
await new Promise(async (resolve) => {
12581258
const newStats = await compile(compiler);
@@ -1306,8 +1306,8 @@ describe('TerserPlugin', () => {
13061306
}
13071307

13081308
expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
1309-
expect(getWarnings(stats)).toMatchSnapshot('errors');
1310-
expect(getErrors(stats)).toMatchSnapshot('warnings');
1309+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
1310+
expect(getErrors(stats)).toMatchSnapshot('errors');
13111311

13121312
new ModifyExistingAsset({ name: 'two.js', comment: true }).apply(compiler);
13131313

@@ -1367,8 +1367,8 @@ describe('TerserPlugin', () => {
13671367
}
13681368

13691369
expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
1370-
expect(getWarnings(stats)).toMatchSnapshot('errors');
1371-
expect(getErrors(stats)).toMatchSnapshot('warnings');
1370+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
1371+
expect(getErrors(stats)).toMatchSnapshot('errors');
13721372

13731373
await new Promise(async (resolve) => {
13741374
const newStats = await compile(compiler);
@@ -1426,8 +1426,8 @@ describe('TerserPlugin', () => {
14261426
}
14271427

14281428
expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
1429-
expect(getWarnings(stats)).toMatchSnapshot('errors');
1430-
expect(getErrors(stats)).toMatchSnapshot('warnings');
1429+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
1430+
expect(getErrors(stats)).toMatchSnapshot('errors');
14311431

14321432
new ModifyExistingAsset({ name: 'two.js', comment: true }).apply(compiler);
14331433

@@ -1489,8 +1489,8 @@ describe('TerserPlugin', () => {
14891489
}
14901490

14911491
expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
1492-
expect(getWarnings(stats)).toMatchSnapshot('errors');
1493-
expect(getErrors(stats)).toMatchSnapshot('warnings');
1492+
expect(getWarnings(stats)).toMatchSnapshot('warnings');
1493+
expect(getErrors(stats)).toMatchSnapshot('errors');
14941494

14951495
await new Promise(async (resolve) => {
14961496
const newStats = await compile(compiler);

0 commit comments

Comments
 (0)
Please sign in to comment.