You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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 🤔
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
andjson-parse-better-errors
(or maybe directly use JSON.parse) as dependencies).Feature Use Case
getOptions
will become available to loaders called vialoader-runner
.thread-loader
is one of them and has an open issue about undefinedthis.getOptions
.I have created a simple reproduction repository for reference.
If you agree I can try to do a PR.
The text was updated successfully, but these errors were encountered: