Y
Y
YaRobot2016-03-10 21:52:57
JavaScript
YaRobot, 2016-03-10 21:52:57

How to assemble files in webpack?

Good evening.
Is it possible to set parameters in the webpack config to build all js files from different directories into one?
In gulp, we make this as easy as shelling pears. Is there something similar for webpack ?

gulp.task('scripts', function() {
  return gulp.src('./assets/js/**/*.js').pipe(concat({
    path: 'app.js'
  })).pipe(gulp.dest(assets + "js/"));
});

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Zuev, 2016-03-10
@YaRobot

node-glob

var glob = require('glob');
var assets = glob.sync('./assets/**/*.js');

module.exports = {
  entry: assets,
  ...

A
Alexander Aksentiev, 2016-03-10
@Sanasol

https://learn.javascript.ru/screencast/webpack

P
pomeo, 2016-03-11
@pomeo

Webpack is not for that. Its charm lies precisely in the fact that it shoves into the final file exactly what we used in the code, and not everything.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question