Skip to content

Error [DataCloneError] when using watch mode on build #1545

@rmehner

Description

@rmehner

👋,

I'm running into this weird build issue and I'm a bit at loss, maybe someone has an idea:

Versions:

Node 16.7.0
macOS 11.5.2 (20G95)
esbuild: 0.12.22

build.js:

const { buildSync } = require('esbuild')

buildSync({
  entryPoints: ['./src/index.ts'],
  outfile: './dist/index.js',
  watch: true
})

index.js:

console.log('Hello world!')

Running node build.js will lead to an error message:

esbuild-data-clone-error/node_modules/esbuild/lib/main.js:1875
      throw reject;
      ^

Error [DataCloneError]: () => {
              if (isStopped)
                return;
              isStopped = true;
              watc...<omitted>... } could not be cloned.
    at esbuild-data-clone-error/node_modules/esbuild/lib/main.js:1913:22
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 25,
  INDEX_SIZE_ERR: 1,
  DOMSTRING_SIZE_ERR: 2,
  HIERARCHY_REQUEST_ERR: 3,
  WRONG_DOCUMENT_ERR: 4,
  INVALID_CHARACTER_ERR: 5,
  NO_DATA_ALLOWED_ERR: 6,
  NO_MODIFICATION_ALLOWED_ERR: 7,
  NOT_FOUND_ERR: 8,
  NOT_SUPPORTED_ERR: 9,
  INUSE_ATTRIBUTE_ERR: 10,
  INVALID_STATE_ERR: 11,
  SYNTAX_ERR: 12,
  INVALID_MODIFICATION_ERR: 13,
  NAMESPACE_ERR: 14,
  INVALID_ACCESS_ERR: 15,
  VALIDATION_ERR: 16,
  TYPE_MISMATCH_ERR: 17,
  SECURITY_ERR: 18,
  NETWORK_ERR: 19,
  ABORT_ERR: 20,
  URL_MISMATCH_ERR: 21,
  QUOTA_EXCEEDED_ERR: 22,
  TIMEOUT_ERR: 23,
  INVALID_NODE_TYPE_ERR: 24,
  DATA_CLONE_ERR: 25
}

However, the index.js file in /dist is emitted just fine. Removing the watch option makes this work without a hitch.

Any pointers much appreciated. I've set up a repo with the exact error so you can try on your machine if you want 👉🏿 https://github.com/rmehner/esbuild-data-clone-error

Thanks in advance!

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