-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
fix(index): copy loader options
before modifying
#326
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clydin Thx
@@ -51,7 +51,7 @@ module.exports = function loader (css, map) { | |||
|
|||
Promise.resolve().then(() => { | |||
const length = Object.keys(options) | |||
.filter((option) => { | |||
.filter((option) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅 👍
@clydin Did you test with |
options
before modifying
The issue stems from this line which is modifying the options object: https://github.com/postcss/postcss-loader/blob/master/lib/options.js#L5 Since that line changes the |
Released in v2.0.10 🎉 Thx |
As per the
loader-utils
documentation (here), the options object should not be modified directly. Doing so causes the loader parameter of aplugins
option function to only be run once at the first use of the loader. This effectively causes the loader parameter to be useless as it cannot be used to retrieve information about the actual resource being used (i.e.,loader.resourcePath
, etc.) instead it will always point to the first resource the loader handled. This PR makes a copy of the options object returned fromgetOptions
.Type
SemVer
Issues
Checklist