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

[feature-request] Parsing a number in query #173

Closed
cdoublev opened this issue Aug 20, 2020 · 5 comments
Closed

[feature-request] Parsing a number in query #173

cdoublev opened this issue Aug 20, 2020 · 5 comments

Comments

@cdoublev
Copy link

Hello,

I would like to sugget parsing a Number in the value of a query parameter used to set options of a loader.

 if (specialValues.hasOwnProperty(value)) {
     value = specialValues[value];
- }
+ } else if (/^\d$/.test(value) {
+     value = Number(value)
+ }

if (specialValues.hasOwnProperty(value)) {

Is there a reason to parse a Boolean but not a Number? Performances?

Eg. css-loader?importLoaders=true works but not css-loader?importLoaders=1.

Note that having css-loader?importLoaders=true not throwing an error is also confusing, since the css-loader doc states that only a Number is expected. Please feel free to ask me to create a new issue in the related repository.

@alexander-akait
Copy link
Member

Sorry, this utils only for compatibility with webpack@4, for webpack@5 it was deprecated, because getOptions built-in webpack@5, so we don't accept features

@alexander-akait
Copy link
Member

alexander-akait commented Aug 20, 2020

Anyway this we should solve it on css-loader side

@alexander-akait
Copy link
Member

Using parseInt, feel free to open an issue

@cdoublev
Copy link
Author

cdoublev commented Aug 20, 2020

Don't you think this concerns schema-utils? Or is it also deprecated?

https://github.com/webpack-contrib/css-loader/blob/835335361cd012f7db114d0c648e4f364050181c/src/index.js#L34

@alexander-akait
Copy link
Member

@cdoublev we should allow importLoaders to be string and use parseInt to get value

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

No branches or pull requests

2 participants