Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

leemars
Copy link

@leemars leemars commented Sep 29, 2018

I fixed two problems when I run npm run test.

  • assert.throws problem of parseQuery test
  • eslint problems

@jsf-clabot
Copy link

jsf-clabot commented Sep 29, 2018

CLA assistant check
All committers have signed the CLA.

@leemars
Copy link
Author

leemars commented Sep 30, 2018

And I fixed two problems in webpack 4.

  • this.options was replaced by this.query in webpack 4
  • this.options.context was replaced by this.rootContext in webpack 4

Refs:
https://webpack.js.org/api/loaders/#this-options
https://webpack.js.org/api/loaders/#this-rootcontext

@leemars leemars changed the title Fix misc problems of test code Fix misc problems in test code and webpack 4 Sep 30, 2018
@leemars
Copy link
Author

leemars commented Nov 23, 2018

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);
Copy link
Member

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

Copy link
Author

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!

Copy link
Member

@alexander-akait alexander-akait Dec 25, 2018

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already fixed

Copy link
Author

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any updates?

@alexander-akait
Copy link
Member

Thanks for the PR, some problem already fixed, some invalid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants