Skip to content

Conversation

guox191
Copy link

@guox191 guox191 commented Mar 23, 2017

Hi,
I think it should use loaderUtils.parseQuery to parse the result from regular expression.
Otherwise we can't get css-loader' query such like ...!css-loader?{"minimize":true}... for css-module.
The last change RP: 1d63e9e
Thanks

@guox191
Copy link
Author

guox191 commented Mar 23, 2017

It seems circleci use old loader-utils version which didn't export parseQuery method

@@ -145,7 +145,7 @@ module.exports = function (content) {
return loader.replace(/((?:^|!)css(?:-loader)?)(\?[^!]*)?/, function (m, $1, $2) {
// $1: !css-loader
// $2: ?a=b
var query = loaderUtils.getOptions($2 || {}) || {}
var query = loaderUtils.parseQuery($2 || '?')
Copy link
Member

Choose a reason for hiding this comment

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

parseQuery is deprecated.

@znck znck closed this Mar 23, 2017
@guox191
Copy link
Author

guox191 commented Mar 23, 2017

@znck
hello
This is latest loader-utils source code: https://github.com/webpack/loader-utils/blob/master/lib/getOptions.js

function getOptions(loaderContext) {
	const query = loaderContext.query;
	if(typeof query === "string" && query !== "") {
		return parseQuery(loaderContext.query);
	}
	if(!query || typeof query !== "object") {
		// Not object-like queries are not supported.
		return null;
	}
	return query;
}

getOptions receive a loader context object, not a string like now.

And parseQuery is not deprecated in latest version, see: webpack/loader-utils@ddf64e4

@iqingting
Copy link

iqingting commented Mar 23, 2017

vue-loader@11.2.0 not compress css now when i use css moules.

@znck @yyx990803

@yyx990803 yyx990803 reopened this Mar 23, 2017
@yyx990803 yyx990803 merged commit c55aafe into vuejs:master Mar 23, 2017
@znck
Copy link
Member

znck commented Mar 23, 2017

@guox191 My bad. Thanks for PR.

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.

4 participants