feat(options): add moduleFilename option#381
Merged
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #381 +/- ##
==========================================
+ Coverage 64.93% 65.19% +0.25%
==========================================
Files 4 4
Lines 405 408 +3
Branches 82 83 +1
==========================================
+ Hits 263 266 +3
Misses 118 118
Partials 24 24
Continue to review full report at Codecov.
|
Member
|
Can you rebase, thanks for PR, good work! |
ef33e7d to
89272ff
Compare
Contributor
Author
done |
|
when will this pr be merged? |
ghostflow
approved these changes
May 9, 2019
alexander-akait
approved these changes
May 10, 2019
|
This doesn't work on chunks that are split out with SplitChunksPlugin – only works for entries. But our team found that new MiniCssExtractPlugin({
chunkFilename: ({ chunk }) => {
if (chunk.entryModule) {
// extracted from entry
return '[name].[contenthash].css';
} else {
// extracted from split chunks
return 'common/css/[name].[contenthash].css'
}
},
}) |
6 tasks
This was referenced Mar 25, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains a:
Motivation / Use-Case
The
filenameoption currently takes a string the enables devs to customize the filename of the generated css file. This works well and the customized filename is created in the same output directory as the js file it is extracted from, however there are cases when the generated files may need to be in different directories. This change enables modifying thefilenameTemplateusing chunk data.Use Case:
webpack.config.js -
entryThe above config will create
dist/main.jsanddemo/assets/js/demo.js.Use:
webpack.config.js -
pluginsWe can change the output directory, chunkhash length and more by using a function that gets called during
compilation.mainTemplate.hooks.renderManifest.Breaking Changes
None
Additional Info