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

Function devServer

packages/dev-server/index.js:14–33  ·  view source on GitHub ↗

* @param {object} [options] See https://webpack.js.org/configuration/dev-server/ * @param {string|string[]} [entry] * @return {Function}

(options = {}, entry = [])

Source from the content-addressed store, hash-verified

12 * @return {Function}
13 */
14function devServer(options = {}, entry = []) {
15 if (options && (typeof options === 'string' || Array.isArray(options))) {
16 entry = options
17 options = {}
18 }
19
20 if (!Array.isArray(entry)) {
21 entry = entry ? [entry] : []
22 }
23
24 const setter = context => prevConfig => {
25 context.devServer = context.devServer || { entry: [], options: {} }
26 context.devServer.entry = context.devServer.entry.concat(entry)
27 context.devServer.options = Object.assign({}, context.devServer.options, options)
28
29 return prevConfig
30 }
31
32 return Object.assign(setter, { post: postConfig })
33}
34
35function postConfig(context, util) {
36 const entryPointsToAdd = context.devServer.entry

Callers 3

developmentConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…