Concurrent Compilation Error
See original GitHub issueCaching the webpack compiler, introduced in PR #109, causes an error when compiling multiple files concurrently.
This issue is not related to gulp however I ran into it when using gulp to compile my project. I am working with a mono-repo where I have a services
directory which contains several microservices. each microservice has its own src
directory which contains an index.js
.
I use the following code to compile each micro service individually
const gulp = require('gulp')
const compiler = require('webpack')
const webpack = require('webpack-stream')
...
gulp.task('webpack', function () {
const tasks = getDirectories(`./services`).map((dir) => {
return gulp.src(join(dir, 'src/index.js'))
.pipe(webpack(require('./webpack.config.js'), compiler))
.pipe(gulp.dest(join(dir, 'dist/')))
})
return merge(tasks)
})
webpack-stream 5.0.0 works as expected and produces a compiled version of each microservice which is stored in a dist
directory alongside its respective src
directory.
webpack-stream 5.1.0 introduced caching and reuses the same webpack instance for each compilation task which results in the following error:
ConcurrentCompilationError: You ran Webpack twice. Each instance only supports a single concurrent compilation at a time.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:23
- Comments:10 (1 by maintainers)
Top GitHub Comments
I came across the same error and fixed it by downgrading to
5.0
, but it would be nice to have the cache working correctly/reliably.I’m also seeing this issue when using
webpack-stream
in combination withgulp.parallel
.