Skip to content

Commit

Permalink
fix: related asset info
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored Sep 19, 2020
1 parent 4103571 commit a75dc8b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ class TerserPlugin {
if (extractedCommentsSource) {
const { commentsFilename } = output;

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

allExtractedComments.set(name, {
extractedCommentsSource,
Expand Down
40 changes: 20 additions & 20 deletions test/TerserPlugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -946,8 +946,8 @@ describe('TerserPlugin', () => {
}

expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
expect(getWarnings(stats)).toMatchSnapshot('errors');
expect(getErrors(stats)).toMatchSnapshot('warnings');
expect(getWarnings(stats)).toMatchSnapshot('warnings');
expect(getErrors(stats)).toMatchSnapshot('errors');

await new Promise(async (resolve) => {
const newStats = await compile(compiler);
Expand Down Expand Up @@ -1007,8 +1007,8 @@ describe('TerserPlugin', () => {
}

expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
expect(getWarnings(stats)).toMatchSnapshot('errors');
expect(getErrors(stats)).toMatchSnapshot('warnings');
expect(getWarnings(stats)).toMatchSnapshot('warnings');
expect(getErrors(stats)).toMatchSnapshot('errors');

await new Promise(async (resolve) => {
const newStats = await compile(compiler);
Expand Down Expand Up @@ -1068,8 +1068,8 @@ describe('TerserPlugin', () => {
}

expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
expect(getWarnings(stats)).toMatchSnapshot('errors');
expect(getErrors(stats)).toMatchSnapshot('warnings');
expect(getWarnings(stats)).toMatchSnapshot('warnings');
expect(getErrors(stats)).toMatchSnapshot('errors');

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

Expand Down Expand Up @@ -1132,8 +1132,8 @@ describe('TerserPlugin', () => {
}

expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
expect(getWarnings(stats)).toMatchSnapshot('errors');
expect(getErrors(stats)).toMatchSnapshot('warnings');
expect(getWarnings(stats)).toMatchSnapshot('warnings');
expect(getErrors(stats)).toMatchSnapshot('errors');

await new Promise(async (resolve) => {
const newStats = await compile(compiler);
Expand Down Expand Up @@ -1194,8 +1194,8 @@ describe('TerserPlugin', () => {
}

expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
expect(getWarnings(stats)).toMatchSnapshot('errors');
expect(getErrors(stats)).toMatchSnapshot('warnings');
expect(getWarnings(stats)).toMatchSnapshot('warnings');
expect(getErrors(stats)).toMatchSnapshot('errors');

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

Expand Down Expand Up @@ -1251,8 +1251,8 @@ describe('TerserPlugin', () => {
}

expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
expect(getWarnings(stats)).toMatchSnapshot('errors');
expect(getErrors(stats)).toMatchSnapshot('warnings');
expect(getWarnings(stats)).toMatchSnapshot('warnings');
expect(getErrors(stats)).toMatchSnapshot('errors');

await new Promise(async (resolve) => {
const newStats = await compile(compiler);
Expand Down Expand Up @@ -1306,8 +1306,8 @@ describe('TerserPlugin', () => {
}

expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
expect(getWarnings(stats)).toMatchSnapshot('errors');
expect(getErrors(stats)).toMatchSnapshot('warnings');
expect(getWarnings(stats)).toMatchSnapshot('warnings');
expect(getErrors(stats)).toMatchSnapshot('errors');

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

Expand Down Expand Up @@ -1367,8 +1367,8 @@ describe('TerserPlugin', () => {
}

expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
expect(getWarnings(stats)).toMatchSnapshot('errors');
expect(getErrors(stats)).toMatchSnapshot('warnings');
expect(getWarnings(stats)).toMatchSnapshot('warnings');
expect(getErrors(stats)).toMatchSnapshot('errors');

await new Promise(async (resolve) => {
const newStats = await compile(compiler);
Expand Down Expand Up @@ -1426,8 +1426,8 @@ describe('TerserPlugin', () => {
}

expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
expect(getWarnings(stats)).toMatchSnapshot('errors');
expect(getErrors(stats)).toMatchSnapshot('warnings');
expect(getWarnings(stats)).toMatchSnapshot('warnings');
expect(getErrors(stats)).toMatchSnapshot('errors');

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

Expand Down Expand Up @@ -1489,8 +1489,8 @@ describe('TerserPlugin', () => {
}

expect(readsAssets(compiler, stats)).toMatchSnapshot('assets');
expect(getWarnings(stats)).toMatchSnapshot('errors');
expect(getErrors(stats)).toMatchSnapshot('warnings');
expect(getWarnings(stats)).toMatchSnapshot('warnings');
expect(getErrors(stats)).toMatchSnapshot('errors');

await new Promise(async (resolve) => {
const newStats = await compile(compiler);
Expand Down

0 comments on commit a75dc8b

Please sign in to comment.