Skip to content

Concurrent Compilation Error #201

Description

@tleef

Caching 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions