loader-runner
loader-runner copied to clipboard
Loader options functions are not serialized correctly
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.
Not sure how it is related to loader-runner, it should be done in thread-loader by main process