Skip to content

sourcemap is not propagated for worker file #88

@rjgotten

Description

@rjgotten

If the source for the worker is treated by other loaders first, e.g. by Babel, then the sourcemap flowing out of those loaders is not propagated correctly by the rpc-worker-loader.

A minimal required and working change is trivial.
Instead of

function rpcWorkerLoader(content) {
  return content + workerScript;
}

do

function rpcWorkerLoader(content, sourcemap) {
  const cb = this.async();
  cb(null, content + workerScript, sourcemap);
}

Though technically, the new lines added by workerScript should be nulled away in the source map. (Webpack has source map helpers for this, iirc.)

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