loader-runner icon indicating copy to clipboard operation
loader-runner copied to clipboard

Loader options functions are not serialized correctly

Open janlent1 opened this issue 2 years ago • 1 comments

If you pass loader options that have a function within them, something like

{
    loader: 'css-loader',
    options: {
        url: {
            filter:
                (url) => {
                    if (url.includes('abc')) {
                        return false;
                    }
                    return true;
                }
        }
    }
} 

then this will be not converted to a function in the worker. Instead the values are missing. Simply JSON.stringify is called, which returns an empty object for url. Instead, we should go through each child and if it is a function we need to call toString. Later in the worker, we then need to set an eval + stringified function, so that it gets set correctly.

janlent1 avatar May 19 '23 15:05 janlent1

Not sure how it is related to loader-runner, it should be done in thread-loader by main process

alexander-akait avatar May 19 '23 16:05 alexander-akait