-
-
Notifications
You must be signed in to change notification settings - Fork 257
fix(index): add this.rootContext
#234
fix(index): add this.rootContext
#234
Conversation
this.context
to this.rootContext
src/index.js
Outdated
@@ -10,7 +10,7 @@ export default function loader(content) { | |||
|
|||
validateOptions(schema, options, 'File Loader'); | |||
|
|||
const context = options.context || this.options.context; | |||
const context = this.rootContext; |
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.
Was the option for a setting a custom context
be removed on purpose?
Doesn't this work anymore in general now ?
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.
Yes, this is breaking for anything that needs is much like we had to do for etwp 3.1
For any loaders & plugins that require this change, make sure the next
branch has the peerDependency
set to 4.x only
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.
So a options.context
can't technically exists anymore with the changes made to the underlying logic in webpack (rootContext
) ?
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.
const context = options.context || this.rootContext || this.options && this.options.context
this.options
doesn't exist anymore. It was already deprecated in webpack 3. webpack 4 adds this.rootContext
as replacement for the needed context
information. We could backport this if it helps.
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.
Is there particular reason to name it rootContext
instead of context
? :) I assumed the meaning/logic also changed somehow due to the rename and the correlation between config.context
=> this.context
is cleaner. There is also no e.g childContext
etc, or is there anything new ?
👍 for a backport of rootContext
to webpack v3.0.0 so loaders/plugins relying on it don't need to add legacy code checks
@TheLarkInn Could you update the PR with @sokra suggestions so we can release a patch instead of a major for this/for now, so folks can continue trying out more advanced stuff (changes) in the meantime ? 😛 (Fairly depressing to fail at the file-loader
🙃...)
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.
Incoming
@TheLarkInn Can I take this over or could you apply these changes - const context = this.rootContext
+ const context = options.context || this.rootContext || this.options && this.options.context and rebase please ? |
this.context
to this.rootContext
this.rootContext
Closing this because someone needs to take a git class ..... |
The fix should go into master please, so webpack v3.0.0 && 4.0.0 is supported by the |
Notable Changes
this.rootContext
(webpack >= v4.0.0
) for compatibility withwebpack
v4.0.0Issues
this.context
=>this.rootContext
(Breaking Change) #233