Skip to content

serialization? #75

@yocontra

Description

@yocontra

Stumbled on it by noticing that my regex's were failing, but raises a larger issue:

Screen Shot 2019-08-15 at 12 18 36 PM

There are plenty of non-JSON values used in loader options that currently break when using thread-loader (regex, dates, functions). It seems like an easy solution would be to use a more comprehensive serialization method, or allow users to plug their own in. This will allow thread-loader to work with even more loaders and seems like a quick win.

I think this is the line in question:

const messageBuffer = Buffer.from(JSON.stringify(data), 'utf-8');

Quick glance shows a few libraries that handle this, I'm sure you could either do this internally or find a better one as well:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions