JeffreyWay / laravel-elixir-webpack-official

88 stars 28 forks source link

minify() breaks sourcemaps, extract-text-plugin, and limits output to 16 files #9

Open lawsonjl opened 8 years ago

lawsonjl commented 8 years ago

I'm not sure exactly what the real issue here is, but when using this elixir plugin to run my webpack build, only 16 out of 88 expected files get generated: a handful of font files and about 5-6 javascript files. No sourcemaps or stylesheets are generated. Running webpack directly builds everything as expected.

This seems like it could be related to this issue as the number of files involved is the same.

I have narrowed down the problem to line 43 of WebpackTask.js. Preventing this.minify() from being called appears to solve the problem, and re-enabling it reliably breaks the build again. Currently I have a monkeypatch I am using as a workaround but of course this is not a 'real' solution:


let WebpackTask = require('laravel-elixir-webpack-official/dist/WebpackTask').default;

WebpackTask.prototype.gulpTask = function () {
    return gulp.src(this.src.path)
               .pipe(this.webpack())
               .on('error', this.onError())
               // .pipe(this.minify())          // Breaks ExtractTextPlugin and sourcemaps 
               // .on('error', this.onError())  // and limits output to 16 files
               .pipe(this.saveAs(gulp))
               .pipe(this.onSuccess());
};

Somewhat perplexingly, attaching a gulp-debug immediately before the saveAs stage of the pipeline fixes most of the issues; all javascript files get generated but still no sourcemaps or stylesheets. Something weird is going on.

jbruni commented 7 years ago

Thanks a lot for sharing the monkeypatch/workaround. I am using it now. I also narrowed down the problem, but I was not finding a way to alter the behaviour.