This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
pass clean options to webpack plugin #511
Merged
eliperelman
merged 6 commits into
neutrinojs:release/v7
from
zeropaper:fix-clean-options
Dec 4, 2017
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8ec4b28
pass clean options to webpack plugin
zeropaper 26905a4
This commit address PR comments on #511
zeropaper 54f6500
use when for consistancy, remove the output check
zeropaper 9cf4070
fix call to neutrino.use clean
zeropaper 3fdd868
move the config.when for clean plugin
zeropaper 5c9ef82
correct clean middleware options
zeropaper File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,10 @@ module.exports = (neutrino, opts = {}) => { | |
polyfills: { | ||
async: true | ||
}, | ||
babel: {} | ||
babel: {}, | ||
clean: { | ||
paths: [neutrino.options.output] | ||
} | ||
}, opts); | ||
|
||
Object.assign(options, { | ||
|
@@ -53,6 +56,11 @@ module.exports = (neutrino, opts = {}) => { | |
}, options.babel) | ||
}); | ||
|
||
Object.assign(options.clean, opts.clean || {}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think you need these lines since you are already setting defaults on line 34. You should be able to safely delete L59-63. |
||
if (!options.clean.paths.includes(neutrino.options.output)) { | ||
options.clean.paths.push(neutrino.options.output); | ||
} | ||
|
||
const staticDir = join(neutrino.options.source, 'static'); | ||
const presetEnvOptions = options.babel.presets[0][1]; | ||
|
||
|
@@ -143,7 +151,7 @@ module.exports = (neutrino, opts = {}) => { | |
.use(optimize.ModuleConcatenationPlugin); | ||
}) | ||
.when(neutrino.options.command === 'build', (config) => { | ||
neutrino.use(clean, { paths: [neutrino.options.output] }); | ||
neutrino.use(clean, options.clean); | ||
neutrino.use(copy, { | ||
patterns: [{ | ||
context: staticDir, | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would also be nice to disable cleaning by passing
false
tooptions.clean
. You should be able to achieve this by changing this to: