MCPcopy Index your code
hub / github.com/andywer/webpack-blocks / createConfig

Function createConfig

packages/core/lib/createConfig.js:18–47  ·  view source on GitHub ↗

* Takes an array of webpack blocks and creates a webpack config out of them. * Each webpack block is a callback function which will be invoked to return a * partial webpack config. These partial configs are merged to create the * final, complete webpack config that will be returned. * * @param

(initialContext, configSetters)

Source from the content-addressed store, hash-verified

16 * @return {object} Webpack config object.
17 */
18function createConfig(initialContext, configSetters) {
19 if (!initialContext) {
20 throw new Error(`No initial context passed.`)
21 }
22 assertConfigSetters(configSetters)
23
24 const baseConfig = {
25 resolve: {
26 // Explicitly define default extensions, otherwise blocks will overwrite them instead of extending
27 extensions: ['.js', '.json']
28 },
29 // Less noisy than default settings
30 stats: {
31 children: false,
32 chunks: false,
33 modules: false,
34 reasons: false
35 },
36 module: {
37 rules: []
38 },
39 plugins: []
40 }
41
42 invokePreHooks(configSetters, initialContext)
43 const config = invokeConfigSetters(configSetters, initialContext, baseConfig)
44 const postProcessedConfig = invokePostHooks(configSetters, initialContext, config)
45
46 return postProcessedConfig
47}

Callers 12

css.test.jsFile · 0.90
url.test.jsFile · 0.90
file.test.jsFile · 0.90
uglify.test.jsFile · 0.90
babel.test.jsFile · 0.90
eslint.test.jsFile · 0.90
match.test.jsFile · 0.50

Calls 4

assertConfigSettersFunction · 0.85
invokePreHooksFunction · 0.85
invokeConfigSettersFunction · 0.85
invokePostHooksFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…