How to use the webpack-config-utils.removeEmpty function in webpack-config-utils

To help you get started, weโ€™ve selected a few webpack-config-utils 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 ournameismud / mud-fractal / gulp / tasks / webpack.config.babel.js View on Github external
plugins: [
							'transform-object-rest-spread',
							'transform-class-properties'
						],
						babelrc: false,
						cacheDirectory: false
					}
				},
				{
					test: /\.js$/,
					loader: 'eslint-loader',
					exclude: /node_modules/
				}
			]
		},
		plugins: removeEmpty([
			new ProgressBarPlugin(),
			new webpack.DefinePlugin({
				'process.env': {
					NODE_ENV: env === 'production' ? '"production"' : '"development"'
				}
			})
		])
	}

	if (env === 'development') {
		// Create new entry object with webpack-hot-middleware and react-hot-loader (if enabled)
		if (!hot || hot.enabled !== false) {
			for (let key in entries) {
				const entry = []
				const hotMiddleware = `webpack-hot-middleware/client?${querystring.stringify(
					hot
github kittn / generator-kittn / generators / app / templates / webpack / webpack.config.babel.js View on Github external
chunks.push(plugin)
})

/*
 |--------------------------------------------------------------------------
 | return webpack config object
 |--------------------------------------------------------------------------
 */

export default {
  // we have to use source map for css source maps, slightly longer compile times
  // devtool: 'source-map',
  context: BASE_PATH,
  // entry is a function so that we can use environment variables
  entry: removeEmpty(entryPoints),
  output: {
    path: outputPath,
    publicPath: '',
    filename: ifProduction(
      assetsPath('js/[name].js')
    ),
    chunkFilename: assetsPath('js/[id].js')
  },
  resolve: {
    extensions: ['.js', '.json', '.vue'],
    modules: [resolve(config.src.base), resolve('node_modules')],
    alias: {
      src: resolve(config.src.base)
    }
  },
  module: {
github lore / lore / upgrade-guides / v0.11-v0.12 / es5 / webpack.config.js View on Github external
loader: 'file-loader',
            options: {
              name: ifProduction(
                'assets/fonts/[name].[hash:8].[ext]',
                'assets/fonts/[name].[ext]'
              )
            }
          }
        },
        {
          test: /\.json/,
          use: 'json-loader'
        }
      ]
    },
    plugins: removeEmpty([
      new webpack.DefinePlugin({
        __LORE_ROOT__: JSON.stringify(__dirname),
        'process.env': {
          'NODE_ENV': JSON.stringify(env)
        }
      }),
      new ProgressBarPlugin(),
      new ExtractTextPlugin(ifProduction(
        'styles.[name].[chunkhash].css',
        'styles.[name].css'
      )),
      ifProduction(new ManifestPlugin({
        fileName: 'asset-manifest.json'
      })),
      ifProduction(new webpack.optimize.CommonsChunkPlugin({
        names: [
github lore / lore / examples / normalization / webpack.config.js View on Github external
loader: 'file-loader',
            options: {
              name: ifProduction(
                'assets/fonts/[name].[hash:8].[ext]',
                'assets/fonts/[name].[ext]'
              )
            }
          }
        },
        {
          test: /\.json/,
          use: 'json-loader'
        }
      ]
    },
    plugins: removeEmpty([
      new webpack.DefinePlugin({
        __LORE_ROOT__: JSON.stringify(__dirname),
        'process.env': {
          'NODE_ENV': JSON.stringify(env)
        }
      }),
      new ProgressBarPlugin(),
      new ExtractTextPlugin(ifProduction(
        'styles.[name].[chunkhash].css',
        'styles.[name].css'
      )),
      ifProduction(new ManifestPlugin({
        fileName: 'asset-manifest.json'
      })),
      ifProduction(new webpack.optimize.CommonsChunkPlugin({
        names: [
github lore / lore / examples / forms-material-ui / webpack.config.js View on Github external
loader: 'file-loader',
            options: {
              name: ifProduction(
                'assets/fonts/[name].[hash:8].[ext]',
                'assets/fonts/[name].[ext]'
              )
            }
          }
        },
        {
          test: /\.json/,
          use: 'json-loader'
        }
      ]
    },
    plugins: removeEmpty([
      new webpack.DefinePlugin({
        __LORE_ROOT__: JSON.stringify(__dirname),
        'process.env': {
          'NODE_ENV': JSON.stringify(env)
        }
      }),
      new ProgressBarPlugin(),
      new ExtractTextPlugin(ifProduction(
        'styles.[name].[chunkhash].css',
        'styles.[name].css'
      )),
      ifProduction(new ManifestPlugin({
        fileName: 'asset-manifest.json'
      })),
      ifProduction(
        new webpack.optimize.CommonsChunkPlugin({
github lore / lore / packages / lore-generate-new / templates / es6 / webpack.config.js View on Github external
loader: 'file-loader',
            options: {
              name: ifProduction(
                'assets/fonts/[name].[hash:8].[ext]',
                'assets/fonts/[name].[ext]'
              )
            }
          }
        },
        {
          test: /\.json/,
          use: 'json-loader'
        }
      ]
    },
    plugins: removeEmpty([
      new webpack.DefinePlugin({
        __LORE_ROOT__: JSON.stringify(__dirname),
        __BASENAME__: JSON.stringify(BASENAME),
        'process.env': {
          'LORE_ENV': JSON.stringify(env.lore || env),
          'NODE_ENV': JSON.stringify(env.webpack || env)
        }
      }),
      new ProgressBarPlugin(),
      new ExtractTextPlugin(ifProduction(
        'styles.[name].[chunkhash].css',
        'styles.[name].css'
      )),
      ifProduction(new ManifestPlugin({
        fileName: 'asset-manifest.json'
      })),
github lore / lore / packages / lore-generate-new / templates / es5 / webpack.config.js View on Github external
loader: 'file-loader',
            options: {
              name: ifProduction(
                'assets/fonts/[name].[hash:8].[ext]',
                'assets/fonts/[name].[ext]'
              )
            }
          }
        },
        {
          test: /\.json/,
          use: 'json-loader'
        }
      ]
    },
    plugins: removeEmpty([
      new webpack.DefinePlugin({
        __LORE_ROOT__: JSON.stringify(__dirname),
        'process.env': {
          'NODE_ENV': JSON.stringify(env)
        }
      }),
      new ProgressBarPlugin(),
      new ExtractTextPlugin(ifProduction(
        'styles.[name].[chunkhash].css',
        'styles.[name].css'
      )),
      ifProduction(new ManifestPlugin({
        fileName: 'asset-manifest.json'
      })),
      ifProduction(new webpack.optimize.CommonsChunkPlugin({
        names: [
github webiny / webiny-js / packages / webiny-scripts / src / spa / webpack.app.js View on Github external
export default ({ projectRoot, appRoot, urlGenerator }) => {
    const definePlugin = new webpack.DefinePlugin({
        "process.env": {
            NODE_ENV: JSON.stringify(process.env.NODE_ENV)
        }
    });

    const plugins = removeEmpty([
        definePlugin,
        ifProduction(new ModuleIdsPlugin()),
        ifProduction(new ChunkIdsPlugin({ projectRoot })),
        ifProduction(new AssetFileNamePlugin()),
        ifDevelopment(new webpack.NoEmitOnErrorsPlugin()),
        ifDevelopment(new webpack.HotModuleReplacementPlugin()),
        new ExtractTextPlugin("styles.css"),
        new AssetsMetaPlugin({ projectRoot, urlGenerator }),
        ifDevelopment(new webpack.NamedModulesPlugin()),
        ifProduction(new webpack.optimize.ModuleConcatenationPlugin()),
        ifProduction(new webpack.HashedModuleIdsPlugin()),
        ifProduction(new UglifyJsPlugin()),
        ifProduction(
            new OptimizeCssAssetsPlugin({
                canPrint: false,
                assetNameRegExp: /\.css$/,
github ournameismud / mud-fractal / gulp / tasks / webpack.config.js View on Github external
module: {
			rules: [
				{
					test: /\.js?$/,
					loader: 'babel-loader',
					exclude: /node_modules/
				},
				{
					test: /\.js$/,
					loader: 'eslint-loader',
					exclude: /node_modules/
				}
			]
		},

		plugins: removeEmpty([
			new ProgressBarPlugin(),

			new webpack.DefinePlugin({
				'process.env': {
					NODE_ENV: env === 'production' ? '"production"' : '"development"'
				}
			}),

			new InjectManifest({
				globDirectory: path.resolve(
					process.env.PWD,
					PATH_CONFIG.public,
					'dist'
				),
				globPatterns: ['**/*.{html,js,css,svg,png}'],
				globIgnores: ['theme.*.css'],
github pixeloven / pixeloven / packages / pixeloven-webpack / config / src / helpers / client.ts View on Github external
export function getEntry(environment: string, publicPath: string): Entry {
    const { ifDevelopment } = getIfUtils(environment);
    const hmrPath = path.normalize(`/${publicPath}/__webpack_hmr`);
    return {
        main: removeEmpty([
            require.resolve("@babel/polyfill"),
            ifDevelopment(
                `webpack-hot-middleware/client?path=${hmrPath}`,
                undefined,
            ),
            resolvePath("src/client/index.tsx"),
        ]),
    }
}

webpack-config-utils

Utilities to help your webpack config be easier to read

MIT
Latest version published 6 years ago

Package Health Score

53 / 100
Full package analysis

Similar packages