Skip to content
This repository was archived by the owner on Dec 5, 2019. It is now read-only.

feat(options): add chunkFilter option #369

Closed

Conversation

WearyMonkey
Copy link

@WearyMonkey WearyMonkey commented Oct 20, 2018

Adds a chunkTest option to filter chunks.

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

The existing test/include/exclude options are not useful when the filenames are generated at buildtime, e.g.

// in your webpack.config.js
entry: {
   myEntry: 'src/foo.js',
},
output: {
   filename: '[hash].[ext]',
},
minimizer: [
  new UglifyJsPlugin({
    include: // ?? no way to match hash here.
   	chunkTest: chunk => chunk.name === 'myEntry',
  }),
]

Breaking Changes

Additional Info

Related to: #21

@jsf-clabot
Copy link

jsf-clabot commented Oct 20, 2018

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Oct 20, 2018

Codecov Report

Merging #369 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #369      +/-   ##
=========================================
+ Coverage   97.69%   97.7%   +0.01%     
=========================================
  Files           5       5              
  Lines         260     262       +2     
  Branches      102     103       +1     
=========================================
+ Hits          254     256       +2     
  Misses          6       6
Impacted Files Coverage Δ
src/index.js 96.45% <100%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf36e21...013ffd4. Read the comment docs.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better name for option/function chunkFilter, also it should be before .filter(ModuleFilenameHelpers.matchObject.bind(null, this.options)), not first

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better name for option/function chunkFilter, also it should be before .filter(ModuleFilenameHelpers.matchObject.bind(null, this.options)), not first

@alexander-akait
Copy link
Member

/cc @michael-ciniawsky what do you think?

@WearyMonkey
Copy link
Author

@evilebottnawi renamed to chunkFilter

also it should be before .filter(ModuleFilenameHelpers.matchObject.bind(null, this.options)), not first

Didn't understand this sorry. Can you provide a code snippet? I thought the chunk filter should go before the chunk file accumulator.

@WearyMonkey
Copy link
Author

@evilebottnawi @michael-ciniawsky any thoughts?

@alexander-akait
Copy link
Member

@WearyMonkey Please read my review above and fix problem

@WearyMonkey
Copy link
Author

@evilebottnawi I'm only seeing:

Better name for option/function chunkFilter

I renamed chunkTest to chunkFilter as you suggested.

also it should be before .filter(ModuleFilenameHelpers.matchObject.bind(null, this.options)), not first

Didn't understand this sorry. Can you provide a code snippet? I thought the chunk filter should go before the chunk file accumulator.

Am I missing something else? I think you commented during the github downtime so maybe something was lost.

@WearyMonkey WearyMonkey changed the title feat(options): add chunkTest option feat(options): add chunkFilter option Oct 29, 2018
smspillaz added a commit to smspillaz/sspilsbury.com that referenced this pull request Nov 1, 2018
We can't meaningfully disable optimization on the asmjs build
until webpack-contrib/uglifyjs-webpack-plugin#369
is complete and it seems like optimization causes the browser to hang
when it runs over the asmjs code
@WearyMonkey
Copy link
Author

@evilebottnawi as far as I can tell I've responded to all your feedback. Am I missing something?

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@alexander-akait
Copy link
Member

Need fix test on windows

@alexander-akait
Copy link
Member

/cc @WearyMonkey can you update snapshots, looks something wrong with cache on appveyor side

@WearyMonkey
Copy link
Author

@evilebottnawi I've updated the snapshots on my mac, and tests are passing. Do I need to update them on Windows as well?

@alexander-akait
Copy link
Member

@WearyMonkey will be great 👍

Adds a chunkFilter option to filter chunks.
The existing test/include/exclude options are not useful when the filenames are generated at buildtime, e.g. `[hash].[ext]`.
@WearyMonkey
Copy link
Author

@evilebottnawi I ran npm test -- -u on windows, and seems to of touched all the snapshots, and the CI is still failing.

Not sure where to go from here?

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need investigate, strange other PRs work good on CI

@alexander-akait
Copy link
Member

Close in favor #382, anyway thanks for the PR and helping to use do webpack better

smspillaz added a commit to smspillaz/sspilsbury.com that referenced this pull request Feb 28, 2019
We can't meaningfully disable optimization on the asmjs build
until webpack-contrib/uglifyjs-webpack-plugin#369
is complete and it seems like optimization causes the browser to hang
when it runs over the asmjs code
smspillaz added a commit to smspillaz/sspilsbury.com that referenced this pull request Aug 14, 2019
We can't meaningfully disable optimization on the asmjs build
until webpack-contrib/uglifyjs-webpack-plugin#369
is complete and it seems like optimization causes the browser to hang
when it runs over the asmjs code
smspillaz added a commit to smspillaz/sspilsbury.com that referenced this pull request Aug 25, 2019
We can't meaningfully disable optimization on the asmjs build
until webpack-contrib/uglifyjs-webpack-plugin#369
is complete and it seems like optimization causes the browser to hang
when it runs over the asmjs code
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants