How to use the webpack-merge.strategy 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 dennisreimann / uiengine / packages / adapter-webpack / src / util.js View on Github external
const debug = (opts, label, ...additional) => {
  if (!opts.debug) return

  const prefix = `WebpackAdapter[${opts.ext}]`
  const [, timingLabel, timingEvent] = label.match(/(.*):(start|end)$/) || []
  if (timingLabel && timingEvent) {
    const action = timingEvent === 'start' ? 'time' : 'timeEnd'
    if (timingEvent === 'start') console.debug(yellow(`${prefix}.${timingLabel} -> start`), additional.join(['\n\n']))
    console[action](yellow(`${prefix}.${timingLabel} -> end`))
  } else {
    console.debug(cyan(`${prefix}.${label}`), additional.join(['\n\n']))
  }
}

const merge = webpackMerge.strategy({ entry: 'replace', output: 'replace' })

const buildConfig = options => {
  const { serverConfig, serverRenderPath, clientConfig, clientRenderPath } = options
  const config = {}

  // deliberately skip optimizations
  const mode = 'development'

  // build webpack config by overriding entry and output
  // and explicitely setting the target
  if (serverConfig && serverRenderPath) {
    config.server = merge(serverConfig, {
      mode,
      name: WEBPACK_NAME_SERVER,
      target: 'node',
      entry: {},
github sebastianhaas / medical-appointment-scheduling / config / webpack.dev.js View on Github external
/**
 * @author: @AngularClass
 */

const helpers = require('./helpers');
const webpackMerge = require('webpack-merge'); // used to merge webpack configs
const webpackMergeDll = webpackMerge.strategy({plugins: 'replace'});
const commonConfig = require('./webpack.common.js'); // the settings that are common to prod and dev

/**
 * Webpack Plugins
 */
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');

/**
 * Webpack Constants
 */
const ENV = process.env.ENV = process.env.NODE_ENV = 'development';
const HOST = process.env.HOST || 'localhost';
const PORT = process.env.PORT || 8080;
github dotCMS / core-web / config / webpack.dev.js View on Github external
/**
 * @author: @AngularClass
 */

const helpers = require('./helpers');
const webpackMerge = require('webpack-merge'); // used to merge webpack configs
const webpackMergeDll = webpackMerge.strategy({plugins: 'replace'});
const commonConfig = require('./webpack.common.js'); // the settings that are common to prod and dev

/**
 * Webpack Plugins
 */
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');

/**
 * Webpack Constants
 */
const ENV = process.env.ENV = process.env.NODE_ENV = 'DEV';
const HOST = process.env.HOST || 'localhost';
const PORT = process.env.PORT || 3000;
github fisenkodv / itinerary / src / Itinerary.Web / Config / webpack.dev.js View on Github external
/**
 * @author: @AngularClass
 */

const helpers = require('./helpers');
const webpackMerge = require('webpack-merge'); // used to merge webpack configs
const webpackMergeDll = webpackMerge.strategy({ plugins: 'replace' });
const commonConfig = require('./webpack.common.js'); // the settings that are common to prod and dev

/**
 * Webpack Plugins
 */
const CopyWebpackPlugin = require('copy-webpack-plugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');

/**
 * Webpack Constants
 */
const ENV = process.env.ENV = process.env.NODE_ENV = 'development';
const HMR = helpers.hasProcessFlag('hot');
const METADATA = webpackMerge(commonConfig({ env: ENV }).metadata, {
  ENV: ENV,
github rabix / composer / config / webpack.electron.dev.js View on Github external
const helpers = require('./helpers');
const webpackMerge = require('webpack-merge'); //
const webpackMergeDll = webpackMerge.strategy({plugins: "replace"});
const commonConfig = require('./webpack.common.js');

const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
const DllBundlesPlugin = require('webpack-dll-bundles-plugin').DllBundlesPlugin;

const ENV = process.env.ENV = process.env.NODE_ENV = 'development';

const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
    host: 'localhost',
    port: 9051,
    ENV: ENV,
});
github velop-io / server / src / classes / Webpack.js View on Github external
updateClientConfig(cfg = {}) {
    let strategy = {};
    if (cfg.entry && cfg.entry.length > 0) {
      strategy.entry = "replace";
    }
    this.clientConfig = webpackMerge.strategy(strategy)(this.clientConfig, cfg);
  }
github Kloudless / file-picker / config / merge-strategy.js View on Github external
const merge = require('webpack-merge');

module.exports = merge.strategy(
  {
    'module.rules': 'append',
    plugins: 'append',
  },
);
github velop-io / server / src / classes / Webpack.js View on Github external
async updateClientConfigWithStrategy(strategy = {}, config = {}) {
    if (!typeof strategy === "object" || !typeof config === "object") {
      this.parent.logger.warn(
        "[Webpack] updateClientConfigWithStrategy(strategy, object) - You must pass a object"
      );
    }
    this.clientConfig = webpackMerge.strategy(strategy)(
      this.clientConfig,
      config
    );
  }