* 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)
| 16 | * @return {object} Webpack config object. |
| 17 | */ |
| 18 | function 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 | } |
no test coverage detected
searching dependent graphs…