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

Function babel

packages/babel/index.js:16–39  ·  view source on GitHub ↗

* @param {object} [options] * @param {bool} [options.cacheDirectory] Use cache directory. Defaults to true. * @param {string[]} [options.plugins] Babel plugins to use. * @param {string[]} [options.presets] Babel presets to use. *

(options = {})

Source from the content-addressed store, hash-verified

14 * @return {Function}
15 */
16function babel(options = {}) {
17 options = Object.assign(
18 {
19 cacheDirectory: true
20 },
21 options
22 )
23
24 const setter = context => prevConfig => {
25 context.babel = context.babel || {}
26
27 // Merge babel config into the one stored in context
28 context.babel = Object.assign(
29 {},
30 context.babel,
31 options,
32 options.plugins ? { plugins: (context.babel.plugins || []).concat(options.plugins) } : {},
33 options.presets ? { presets: (context.babel.presets || []).concat(options.presets) } : {}
34 )
35 return prevConfig
36 }
37
38 return Object.assign(setter, { post: postConfig })
39}
40
41function postConfig(context, util) {
42 const ruleConfig = Object.assign(

Callers 4

webpack.config.jsFile · 0.85
babel.test.jsFile · 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…