Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loader options functions are not serialized correctly #70

Open
janlent1 opened this issue May 19, 2023 · 1 comment
Open

Loader options functions are not serialized correctly #70

janlent1 opened this issue May 19, 2023 · 1 comment

Comments

@janlent1
Copy link

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.

@alexander-akait
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants