loader-runner
                                
                                
                                
                                    loader-runner copied to clipboard
                            
                            
                            
                        Feature proposal: Add getOptions to loaderContext inside runLoaders
Feature Proposal
Introduces getOptions function inside loaderContext.
The implementation of this function should mirror the one inside webpack NormalModule.
I think we can use loader context in the same way of webpack to extract loader's options and validate them if a schema is provided (Include schema-utils and json-parse-better-errors (or maybe directly use JSON.parse) as dependencies).
Feature Use Case
getOptions will become available to loaders called via loader-runner.
thread-loader is one of them and has an open issue about undefined this.getOptions.
I have created a simple reproduction repository for reference. If you agree I can try to do a PR.
What would your implementation look like? Would you be checking for the presence of 'getOptions' in the loaderContext and add it if not there? Maybe the original PR that added 'getOptions' to webpack should've just lived in this repo to prevent code duplication 🤔