-
-
Notifications
You must be signed in to change notification settings - Fork 620
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: assign config paths in build dependencies in cache config (#1900)
- Loading branch information
Showing
8 changed files
with
132 additions
and
19 deletions.
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const cacheDefaults = (finalConfig, parsedArgs) => { | ||
// eslint-disable-next-line no-prototype-builtins | ||
const hasCache = finalConfig.hasOwnProperty('cache'); | ||
let cacheConfig = {}; | ||
if (hasCache && parsedArgs.config) { | ||
if (finalConfig.cache && finalConfig.cache.type === 'filesystem') { | ||
cacheConfig.buildDependencies = { | ||
config: parsedArgs.config, | ||
}; | ||
} | ||
return { cache: cacheConfig }; | ||
} | ||
return cacheConfig; | ||
}; | ||
|
||
const assignFlagDefaults = (compilerConfig, parsedArgs) => { | ||
if (Array.isArray(compilerConfig)) { | ||
return compilerConfig.map((config) => cacheDefaults(config, parsedArgs)); | ||
} | ||
return cacheDefaults(compilerConfig, parsedArgs); | ||
}; | ||
|
||
module.exports = assignFlagDefaults; |
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("Mizuhara Chizuru") |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const WebpackCLITestPlugin = require('../utils/webpack-cli-test-plugin'); | ||
|
||
module.exports = { | ||
entry: './src/main.js', | ||
mode: 'development', | ||
cache: { | ||
type: 'filesystem', | ||
name: 'config-cache', | ||
}, | ||
name: 'compiler-cache', | ||
plugins: [new WebpackCLITestPlugin(['cache'])], | ||
}; |
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