How to use the webpack-merge.smartStrategy 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 AlloyTeam / omi-cli / template / x / tools / webpack.base.js View on Github external
output: configCustom.getOutput(),
    module: configCustom.getModule(),
    resolve: configCustom.getResolve(),
    externals: configCustom.getExternals(),
    plugins: configCustom.getPlugins(),
};

var otherConfig = configCustom.getOtherOptions();

for (let key in otherConfig) {
    userConfig[key] = otherConfig[key];
}

baseConfig = configWebpackMerge.mergeProcess(baseConfig);

var webpackConfig = webpackMerge.smartStrategy(
    configWebpackMerge.smartStrategyOption
)(baseConfig, userConfig);

// console.log(JSON.stringify(webpackConfig, null, 4));

module.exports = webpackConfig;
github steamerjs / steamer-vue / tools / webpack.base.js View on Github external
resolve: configCustom.getResolve(),
    externals: configCustom.getExternals(),
    plugins: configCustom.getPlugins()
};

let otherConfig = configCustom.getOtherOptions();

for (let key in otherConfig) {
    if (otherConfig.hasOwnProperty(key)) {
        userConfig[key] = otherConfig[key];
    }
}

baseConfig = configWebpackMerge.mergeProcess(baseConfig);

let webpackConfig = webpackMerge.smartStrategy(
    configWebpackMerge.smartStrategyOption
)(baseConfig, userConfig);

// console.log(JSON.stringify(webpackConfig, null, 4));

module.exports = webpackConfig;
github jaredLunde / react-broker / examples / hello-world / webpack / createConfig.js View on Github external
module.exports = function createConfig (...configs) {
  let {
    target = 'web',
    ...config
  } = merge.smartStrategy({'module.rules': 'prepend'})(...configs)

  const envTarget = target === 'node' ? {"node": "current"} : {"browsers": "defaults"}

  const mainFields =
    target === 'web'
    ? ['browser', 'jsnext', 'esnext', 'jsnext:main', 'main']
    : ['jsnext', 'esnext', 'jsnext:main', 'main']

  return merge.smartStrategy({'module.rules': 'prepend'})(
    {
      devtool: process.env.NODE_ENV !== 'production' ? 'eval' : false,
      target,

      // The base directory for resolving the entry option
      output: {
        publicPath: '/public/',
        pathinfo: true
      },

      // Where to resolve our loaders
      resolveLoader: {
        modules: ['node_modules'],
        moduleExtensions: ['-loader'],
      },
github cozy / create-cozy-app / packages / cozy-scripts / scripts / config.js View on Github external
function mergeWithOptions(options, configs, current) {
  // merge with the previous configs using the provided strategy
  if (options.strategy) {
    return options.smart
      ? merge.smartStrategy(options.strategy)(...configs, current)
      : merge.strategy(options.strategy)(...configs, current)
  } else {
    return options.smart
      ? merge.smart(...configs, current)
      : merge(...configs, current)
  }
}
github Comcast / patternlab-edition-node-webpack / webpack.config.js View on Github external
module.exports = env => {
  const { ifProduction, ifDevelopment } = getIfUtils(env);

  const config = merge.smartStrategy(plConfig.app.webpackMerge)(
    {
      devtool: ifDevelopment("source-map"),
      context: resolve(__dirname, plConfig.paths.source.root),
      node: {
        fs: "empty"
      },
      entry: {
        // Gathers any Source JS files and creates a bundle
        //NOTE: This name can be changed, if so, make sure to update _meta/01-foot.mustache
        "js/pl-source": globby
          .sync([
            resolve(__dirname, `${plConfig.paths.source.js}**/*.js`),
            "!**/*.test.js"
          ])
          .map(function(filePath) {
            return filePath;
github sysgears / spinjs / src / Spin.ts View on Github external
public mergeWithStrategy(strategy: any, config: any, overrides: any): Configuration {
    return merge.smartStrategy(strategy)(config, overrides);
  }
}
github sysgears / larix / packages / zen / src / Zen.ts View on Github external
public mergeWithStrategy(strategy: any, config: any, overrides: any): Configuration {
    return merge.smartStrategy(strategy)(config, overrides);
  }
}
github percy / react-percy / packages / react-percy-webpack / src / compile / createCompiler.js View on Github external
export default function createCompiler(percyConfig) {
  const config = merge.smartStrategy({
    'module.rules': 'prepend',
    plugins: 'prepend',
  })(percyConfig.webpack, {
    bail: true,
    context: percyConfig.rootDir,
    devtool: percyConfig.webpack.devtool || '#cheap-module-source-map',
    entry: getEntry(percyConfig),
    module: {
      rules: [
        {
          test: /\.(js|jsx)$/,
          loader: require.resolve('babel-loader'),
          query: babelConfig,
          exclude: /node_modules/,
        },
      ],