-
-
Notifications
You must be signed in to change notification settings - Fork 184
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 misc problems in test code and webpack 4 #116
Conversation
And I fixed two problems in webpack 4.
Refs: |
Any progress? |
@@ -14,7 +14,7 @@ function isRelativePath(str) { | |||
|
|||
function stringifyRequest(loaderContext, request) { | |||
const splitted = request.split("!"); | |||
const context = loaderContext.context || (loaderContext.options && loaderContext.options.context); | |||
const context = loaderContext.context || loaderContext.rootContext || (loaderContext.options && loaderContext.options.context); |
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.
rootContext
and context
are difference, and it is invalid fix, rootContext
is context for request, context
is webpack
context
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.
But according to this, this.options.context
has been changed to this.rootContext
. I thought this
is just the loaderContext
. Could you give me some more explanation? Thanks!
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.
hm, looks my mistake, can you create new PR?
@@ -90,8 +91,9 @@ function interpolateName(loaderContext, name, options) { | |||
); | |||
}); | |||
} | |||
if(typeof loaderContext.options === "object" && typeof loaderContext.options.customInterpolateName === "function") { | |||
url = loaderContext.options.customInterpolateName.call(loaderContext, url, name, options); | |||
const loaderContextOptions = getOptions(loaderContext); |
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.
Already fixed
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.
Could you check this again? According to https://webpack.js.org/api/loaders/#this-options , this.options
has been removed in webpack 4. And according to https://webpack.js.org/api/loaders/#this-query , we should use getOptions
to extract given loader options.
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.
Any updates?
Thanks for the PR, some problem already fixed, some invalid |
I fixed two problems when I run
npm run test
.