Socket
Socket
Sign inDemoInstall

webpack-stream

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-stream

Run webpack as a stream


Version published
Weekly downloads
123K
increased by0.24%
Maintainers
1
Weekly downloads
 
Created

What is webpack-stream?

webpack-stream is a Node.js package that allows you to run Webpack as a stream to use with Gulp. It integrates Webpack's bundling capabilities with Gulp's streaming build system, enabling you to bundle JavaScript modules and other assets within a Gulp task.

What are webpack-stream's main functionalities?

Bundling JavaScript

This feature allows you to bundle JavaScript files using Webpack within a Gulp task. The code sample demonstrates how to bundle a JavaScript file located at 'src/index.js' and output the bundled file as 'bundle.js' in the 'dist/' directory.

const gulp = require('gulp');
const webpack = require('webpack-stream');

gulp.task('scripts', function() {
  return gulp.src('src/index.js')
    .pipe(webpack({
      mode: 'development',
      output: {
        filename: 'bundle.js'
      }
    }))
    .pipe(gulp.dest('dist/'));
});

Handling CSS

This feature allows you to handle CSS files using Webpack within a Gulp task. The code sample demonstrates how to process a CSS file located at 'src/styles.css' and output the processed file as 'styles.js' in the 'dist/' directory.

const gulp = require('gulp');
const webpack = require('webpack-stream');

gulp.task('styles', function() {
  return gulp.src('src/styles.css')
    .pipe(webpack({
      mode: 'development',
      module: {
        rules: [
          {
            test: /\.css$/,
            use: ['style-loader', 'css-loader']
          }
        ]
      },
      output: {
        filename: 'styles.js'
      }
    }))
    .pipe(gulp.dest('dist/'));
});

Transpiling ES6+ to ES5

This feature allows you to transpile ES6+ JavaScript code to ES5 using Babel within a Gulp task. The code sample demonstrates how to transpile a JavaScript file located at 'src/app.js' and output the transpiled file as 'app.js' in the 'dist/' directory.

const gulp = require('gulp');
const webpack = require('webpack-stream');

gulp.task('transpile', function() {
  return gulp.src('src/app.js')
    .pipe(webpack({
      mode: 'development',
      module: {
        rules: [
          {
            test: /\.js$/,
            exclude: /node_modules/,
            use: {
              loader: 'babel-loader',
              options: {
                presets: ['@babel/preset-env']
              }
            }
          }
        ]
      },
      output: {
        filename: 'app.js'
      }
    }))
    .pipe(gulp.dest('dist/'));
});

Other packages similar to webpack-stream

Keywords

FAQs

Package last updated on 02 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc