How to use the webpack-merge.smart 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 learningequality / kolibri / frontend_build / src / parse_bundle_plugin.js View on Github external
__once: JSON.stringify(data.once || {}),
        __version: JSON.stringify(data.version),
        // This is necessary to allow modules that use service workers to fetch their service
        // worker code
        __publicPath: JSON.stringify(publicPath),
      }),
      new extract$trs(data.locale_data_folder, data.name),
      // Add custom messages per bundle.
      new WebpackMessages({
        name: data.name,
        logger: str => logging.info(str),
      }),
    ],
  };

  bundle = merge.smart(bundle, base_bundle, local_config);

  return bundle;
};
github CanopyTax / single-spa-angular / src / webpack / index.ts View on Github external
'Access-Control-Allow-Headers': '*',
      },
    },
    module: {
      rules: [
        {
          parser: {
            system: false
          }
        }
      ]
    }
  }

  // @ts-ignore
  const mergedConfig: any = webpackMerge.smart(config, singleSpaConfig)

  removePluginByName(mergedConfig.plugins, 'IndexHtmlWebpackPlugin');
  removeMiniCssExtract(mergedConfig);

  if (Array.isArray(mergedConfig.entry.styles)) {
    // We want the global styles to be part of the "main" entry. The order of strings in this array
    // matters -- only the last item in the array will have its exports become the exports for the entire
    // webpack bundle
    mergedConfig.entry.main = [...mergedConfig.entry.styles, ...mergedConfig.entry.main];
  }

  // Remove bundles
  delete mergedConfig.entry.polyfills;
  delete mergedConfig.entry.styles;
  delete mergedConfig.optimization.runtimeChunk;
  delete mergedConfig.optimization.splitChunks;
github web-pal / DBGlass / webpack.config.main.prod.js View on Github external
/**
 * Webpack config for production electron main process
 */

import webpack from 'webpack';
import merge from 'webpack-merge';
import BabiliPlugin from 'babili-webpack-plugin';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import baseConfig from './webpack.config.base';

export default merge.smart(baseConfig, {
  devtool: 'source-map',

  target: 'electron-main',

  entry: ['babel-polyfill', './app/main.dev'],

  // 'main.js' in root
  output: {
    path: __dirname,
    filename: './app/main.prod.js',
  },

  plugins: [
    /**
     * Babli is an ES6+ aware minifier based on the Babel toolchain (beta)
     */
github MorpheoOrg / morpheo-analytics / webpack / electron / main.js View on Github external
/**
 * Webpack config for production electron main process
 */

import HappyPack from 'happypack';
import merge from 'webpack-merge';
import BabelMinifyPlugin from 'babel-minify-webpack-plugin';
import {BundleAnalyzerPlugin} from 'webpack-bundle-analyzer';
import baseConfig from './base';

import definePlugin from '../utils/definePlugin';
import rules from '../utils/rules';


export default merge.smart(baseConfig, {
    devtool: 'source-map',
    target: 'electron-main',
    entry: './src/electron/main',
    // 'main.js' in root
    output: {
        path: __dirname,
        filename: '../../build/electron/index.js',
    },
    module: {
        rules: rules('electron'),
    },
    plugins: [
        new HappyPack({
            id: 'babel',
            loaders: [{
                path: 'babel-loader', // Options to configure babel with
github codice / ddf / ui / packages / catalog-ui-search / webpack / config / devServer.js View on Github external
// force the cookie to be insecure since the proxy is over http
        proxyRes.headers['set-cookie'] = cookie[0].replace(new RegExp(/;\w?Secure/), '')
    }
};

var proxyConfig = function (target) {
    return {
        ws: true,
        target: target,
        secure: false,
        changeOrigin: true,
        onProxyRes: handleProxyRes
    }
};

module.exports = merge.smart(dev, {
    devServer: {
        progress: true,
        historyApiFallback: true,
        inline: true,
        hot: true,
        contentBase: [
            resolve('/src/main/webapp/')
        ],
        proxy: {
            '/search/catalog/**': proxyConfig('https://localhost:8993'),
            '/services/**': proxyConfig('https://localhost:8993'),
            '/styles/**': proxyConfig('https://localhost:8993/search/catalog'),
            '/cesium/**': proxyConfig('https://localhost:8993/search/catalog')
        }
    },
    module: {
github greymass / eos-voter / webpack.config.renderer.prod.js View on Github external
/**
 * Build config for electron renderer process
 */

import path from 'path';
import webpack from 'webpack';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import merge from 'webpack-merge';
import UglifyJSPlugin from 'uglifyjs-webpack-plugin';
import baseConfig from './webpack.config.base';
import CheckNodeEnv from './internals/scripts/CheckNodeEnv';

CheckNodeEnv('production');

export default merge.smart(baseConfig, {
  devtool: 'source-map',
  mode: 'production',

  target: 'electron-renderer',

  entry: {
    basic: [
      'babel-polyfill',
      path.join(__dirname, 'app/renderer/basic/index'),
    ]
  },

  output: {
    ...baseConfig.output,
    path: path.join(__dirname, 'app/dist'),
    publicPath: './dist/',
github mongodb-js / compass-aggregations / config / webpack.karma.config.js View on Github external
},
  module: {
    rules: [
      {
        test: /\.(png|jpg|jpeg|gif|svg)$/,
        use: [{ loader: 'ignore-loader' }]
      },
      {
        test: /\.(woff|woff2|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
        use: [{ loader: 'ignore-loader' }]
      }
    ]
  }
};

module.exports = merge.smart(baseWebpackConfig, config);
github vuexpress / vuexpress / src / renderer / compiler.js View on Github external
plugins: [
        new VueLoaderPlugin(),
        new MiniCssExtractPlugin({
          filename: 'style.css'
        }),
        new webpack.DefinePlugin({
          'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
          'process.env.VUE_ENV': '"server"',
        }),
        new webpack.LoaderOptionsPlugin({
          debug: process.env.NODE_ENV === 'development'
        })
      ],
    };

    let webpackMerged = webpackMerge.smart(defaultConfig, this.options.config);

    if (typeof this.options.configCallback === 'function') {
      webpackMerged = this.options.configCallback(webpackMerged);
    }

    return webpackMerged;
  }
github chentsulin / redux-boilerplate / webpack.config.prod.js View on Github external
const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

const config = require('./webpack.config.base');

module.exports = merge.smart(config, {
  devtool: 'cheap-module-source-map',
  entry: './src/index',
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle-[chunkhash].js',
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: JSON.stringify('production'),
      },
    }),
    new webpack.optimize.UglifyJsPlugin({
      sourceMap: true,
      compress: {
        screw_ie8: true,