How to use the webpack-merge.apply function in webpack-merge

To help you get started, we’ve selected a few webpack-merge examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github survivejs / webpack-presets / src / evaluate.js View on Github external
export default function evaluate({
    rootPath, actions, formats, presets, webpackrc, target
  }, ...config) {
  actions = actions || noop;
  formats = formats || noop;
  presets = presets || noop;

  const rcConfiguration = merge.apply(null, [webpackrc].concat(
    parse(apply(presets, paths), webpackrc.presets))
  );
  const parsedEnv = rcConfiguration.env[target] || {};
  const commonConfig = rcConfiguration.common ?
    rcConfiguration.common[target.split(':')[0]] || {} :
    {};
  const paths = resolvePaths(
    rootPath,
    Object.assign({}, rcConfiguration.paths, commonConfig.paths, parsedEnv.paths)
  );
  const evaluatedActions = apply(actions, paths);
  const evaluatedFormats = apply(formats, paths);
  const rootConfig = {
    resolve: {
      extensions: ['']
    }
github survivejs / webpack-presets / src / evaluate.js View on Github external
rootPath,
    Object.assign({}, rcConfiguration.paths, commonConfig.paths, parsedEnv.paths)
  );
  const evaluatedActions = apply(actions, paths);
  const evaluatedFormats = apply(formats, paths);
  const rootConfig = {
    resolve: {
      extensions: ['']
    }
  };
  const parsedRootActions = parse(evaluatedActions, rcConfiguration.actions);
  const parsedActions = parse(evaluatedActions, parsedEnv.actions);
  const parsedRootFormats = parse(evaluatedFormats, rcConfiguration.formats);
  const parsedFormats = parse(evaluatedFormats, parsedEnv.formats);

  return merge.apply(null, [rootConfig, commonConfig].
    concat(parsedRootActions).concat(parsedRootFormats).concat([
      parsedEnv
    ]).concat(config).concat(parsedActions).concat(parsedFormats));
}
github gonzofish / angular-librarian / commands / initial / templates / webpack / webpack.common.js View on Github external
module.exports = (type, typeConfig) => {
    const configs = [getCommonConfig(type), typeConfig];
    const customConfigPath = webpackUtils.rootPath('configs', `webpack.${ type }.js`);

    if (fs.existsSync(customConfigPath)) {
        let customConfig = require(customConfigPath);

        if (Object.prototype.toString.call(customConfig) === '[object Function]') {
            customConfig = customConfig();
        }

        configs.push(customConfig);
    }

    return webpackMerge.apply(null, configs);
};
github survivejs / webpack-presets / src / evaluate.js View on Github external
function apply(configuration, paths) {
  if (Array.isArray(configuration)) {
    return merge.apply(null, configuration.map((conf) => conf(paths)));
  }

  return configuration(paths);
}
github cozy / create-cozy-app / packages / cozy-scripts / config / webpack.bundle.vue.js View on Github external
require('./webpack.config.pictures'),
  require('./webpack.config.vendors'),
  require('./webpack.config.manifest'),
  require('./webpack.config.progress'),
  addAnalyzer ? require('./webpack.config.analyzer') : null,
  require('./webpack.config.services'),
  require(`./webpack.target.${target}`)
]

if (environment === 'production') {
  configs.push(require('./webpack.environment.prod'))
} else {
  configs.push(require('./webpack.environment.dev'))
}

module.exports = merge.apply(null, configs)
github cozy / create-cozy-app / packages / cozy-scripts / config / webpack.bundle.preact.js View on Github external
require('./webpack.config.pictures'),
  require('./webpack.config.vendors'),
  require('./webpack.config.manifest'),
  require('./webpack.config.progress'),
  addAnalyzer ? require('./webpack.config.analyzer') : null,
  require('./webpack.config.services'),
  require(`./webpack.target.${target}`)
]

if (environment === 'production') {
  configs.push(require('./webpack.environment.prod'))
} else {
  configs.push(require('./webpack.environment.dev'))
}

module.exports = merge.apply(null, configs)
github cozy / create-cozy-app / packages / cozy-scripts / config / webpack.bundle.default.js View on Github external
require('./webpack.config.pictures'),
  require('./webpack.config.assets'),
  require('./webpack.config.manifest'),
  require('./webpack.config.progress'),
  addAnalyzer ? require('./webpack.config.analyzer') : null,
  require('./webpack.config.services'),
  require(`./webpack.target.${target}`)
]

if (environment === 'production') {
  configs.push(require('./webpack.environment.prod'))
} else {
  configs.push(require('./webpack.environment.dev'))
}

module.exports = merge.apply(null, configs)