How to use webpack-stream - 10 common examples

To help you get started, we’ve selected a few webpack-stream 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 HaNdTriX / generator-chrome-extension-kickstart / app / templates / tasks / scripts.js View on Github external
gulp.task('scripts', (cb) => {
  return gulp.src('app/scripts/*.js')
    .pipe(plumber({
      // Webpack will log the errors
      errorHandler () {}
    }))
    .pipe(named())
    .pipe(gulpWebpack({
      devtool: args.sourcemaps ? 'inline-source-map' : false,
      watch: args.watch,
      plugins: [
        new webpack.DefinePlugin({
          'process.env.NODE_ENV': JSON.stringify(ENV),
          'process.env.VENDOR': JSON.stringify(args.vendor)
        })
      ].concat(args.production ? [
        new BabiliPlugin()
      ] : []),
      module: {
        rules: [{
          test: /\.js$/,
          loader: 'babel-loader'
        }]
      }
github facebook / relay / gulpfile.js View on Github external
externals: [/^[-/a-zA-Z0-9]+$/, /^@babel\/.+$/],
    target: opts.target,
    node: {
      fs: 'empty',
      net: 'empty',
      path: 'empty',
      child_process: 'empty',
      util: 'empty',
    },
    output: {
      filename: filename,
      libraryTarget: opts.libraryTarget,
      library: opts.libraryName,
    },
    plugins: [
      new webpackStream.webpack.DefinePlugin({
        'process.env.NODE_ENV': JSON.stringify(
          isProduction ? 'production' : 'development',
        ),
      }),
      new webpackStream.webpack.optimize.OccurrenceOrderPlugin(),
    ],
  };
  if (isProduction && !opts.noMinify) {
    // See more chunks configuration here: https://gist.github.com/sokra/1522d586b8e5c0f5072d7565c2bee693
    webpackOpts.optimization = {
      minimize: true,
    };
  }
  return webpackStream(webpackOpts, webpack, function(err, stats) {
    if (err) {
      throw new gulpUtil.PluginError('webpack', err);
github wavesoft / jbb / gulpfile.js View on Github external
'fs': 'empty'
		    },
		    output: {
		    	// The output filename
		    	filename: PROD ? 'jbb.min.js' : 'jbb.js',
				// Export itself to a global var
				libraryTarget: 'var',
				// Name of the global var: 'JBB.BinaryLoader'
				library: [ 'JBB', 'BinaryLoader' ]
			},
			externals: {
				'three': 'THREE',
			},
		    plugins: ([
		    	new webpack.webpack.optimize.DedupePlugin(),
				new webpack.webpack.DefinePlugin({
				    GULP_BUILD 	: PROD
				})
		    ]).concat(PROD ? [
			    new webpack.webpack.optimize.UglifyJsPlugin({
			    	minimize: true
			    })
		    ] : [])
		}))
		.pipe(header("/* JBB Binary Bundle Loader - https://github.com/wavesoft/jbb */\n"))
		.pipe(gulp.dest('dist'));
});
github DarkPark / stb / gulpfile.js View on Github external
.pipe(plumber())
		.pipe(webpack({
			output: {
				filename: 'build.js',
				pathinfo: true,
				sourcePrefix: '\t\t\t'
			},
			resolve: {
				root: path.join(__dirname, 'app', 'js')
			},
			devtool: 'source-map',
			plugins: [
				// fix compilation persistence
				new webpack.webpack.optimize.OccurenceOrderPlugin(true),
				// global constants
				new webpack.webpack.DefinePlugin({
					DEBUG: false
				})
			]
		}, null/*, report*/))
		.pipe(gulp.dest('tests'));
});
github DarkPark / stb / tpl / tasks / webpack.js View on Github external
.src(path.join(global.paths.app, 'js', 'main.js'))
		.pipe(plumber())
		.pipe(webpack({
			output: {
				filename: 'release.js'
			},
			resolve: {
				extensions:['', '.js']
			},
			debug: false,
			cache: false,
			plugins: [
				// fix compilation persistence
				new webpack.webpack.optimize.OccurenceOrderPlugin(true),
				// global constants
				new webpack.webpack.DefinePlugin({
					DEBUG: false
				}),
				// obfuscation
				new webpack.webpack.optimize.UglifyJsPlugin({
					// this option prevents name changing
					// use in case of strange errors
					// mangle: false,
					output: {
						comments: false
					},
					/*eslint camelcase:0 */
					compress: {
						warnings: true,
						unused: true,
						dead_code: true,
						drop_console: true,
github MozaikAgency / wp-theme-starter / gulp / core / config / scripts.js View on Github external
// merged with defaults
			// for :dev task
			dev: {
				devtool: 'eval'
			},


			// merged with defaults
			// for :prod task
			prod: {
				plugins: [
					new webpack.optimize.DedupePlugin(),
					new webpack.optimize.OccurenceOrderPlugin(true),
					new webpack.optimize.UglifyJsPlugin({
						sourceMap: false,
						comments: false,
						screw_ie8: true,
						compress: {
							drop_console: true,
							unsafe: true,
							unsafe_comps: true,
							screw_ie8: true,
							warnings: false
						}
					})
				],
				eslint: {
					failOnError: true,
					failOnWarning: true
				}
github MozaikAgency / wp-theme-starter / gulp / core / config / scripts.js View on Github external
keepalive: true
			},


			// merged with defaults
			// for :dev task
			dev: {
				devtool: 'eval'
			},


			// merged with defaults
			// for :prod task
			prod: {
				plugins: [
					new webpack.optimize.DedupePlugin(),
					new webpack.optimize.OccurenceOrderPlugin(true),
					new webpack.optimize.UglifyJsPlugin({
						sourceMap: false,
						comments: false,
						screw_ie8: true,
						compress: {
							drop_console: true,
							unsafe: true,
							unsafe_comps: true,
							screw_ie8: true,
							warnings: false
						}
					})
				],
				eslint: {
					failOnError: true,
github io-monad / textlint-chrome-extension / tasks / scripts.js View on Github external
export function buildForTest() {
  if (args.watch) {
    return gulp.src(["tests/entry.js"])
      .pipe(gulpWebpack(getWebpackConfig(true)))
      .pipe(sourcemaps.init({ loadMaps: true }))
      .pipe(espower())
      .pipe(sourcemaps.write())
      .pipe(gulp.dest("tmp/scripts"));
  } else {
    return gulp.src(["tests/entry.js"])
      .pipe(gulpWebpack(getWebpackConfig(true)))
      .pipe(gulp.dest("tmp/scripts"));
  }
}
github gfpaiva / jussitb / templates / project / gulpTasks / scripts.js View on Github external
test: /\.html$/,
							use: {
								loader: 'dust-loader'
							}
						}
					]
				},
				mode: $.util.env.production ? 'production' : 'development',
				optimization: {
					minimize: $.util.env.production ? true : false,
				},
				plugins: [
					new webpack.webpack.DefinePlugin({
						VERSION: JSON.stringify(_.pkg.version)
					}),
					new webpack.webpack.BannerPlugin('Build Version: ' + _.pkg.version),
					$.util.env.production ? $.util.noop : new HardSourceWebpackPlugin()
				],
				devtool: $.util.env.production ? '' : 'eval-source-map'
			}))
			.pipe($.preprocess(_.preprocessContext))
			.pipe((_.isProdEnv()) ? gulp.dest(_.paths.dest.default) : gulp.dest(_.paths.dest.files))
			.pipe($.filter(f => /checkout/.test(f.path)))
			.pipe($.rename(file => file.basename = file.basename.replace('.min', '')))
			.pipe(gulp.dest(_.paths.dest.files));
	};
github Whatever-Inc / KAMRA-Deja-Vu / main / gulpfile.babel.js View on Github external
output: {
        filename: '[id].worker.js'
      }
    }
  }
  if (developmentMode) {
    config.devtool = 'inline-source-map'
  } else {
    config.plugins.push(
      new webpack.optimize.UglifyJsPlugin(),
      new webpack.optimize.DedupePlugin(),
      new webpack.NoErrorsPlugin()
    )
  }
  return gulp.src('')
    .pipe(webpackStream(config, null, (err, stats) => {
      if (!err) {
        $.util.log(stats.toString({
          colors: $.util.colors.supportsColor,
          chunks: !developmentMode,
          chunkModules: !developmentMode
        }))
        browserSync.reload()
      }
    }))
    .pipe(gulp.dest('./public'))
})

webpack-stream

Run webpack as a stream

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis