Skip to content

test: failing test cases for inline syntax and modules: auto #1273

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

Closed
wants to merge 1 commit into from

Conversation

jquense
Copy link
Contributor

@jquense jquense commented Mar 11, 2021

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

Breaking Changes

Additional Info

"button.modules.css!=!./index-loader-syntax-sass.css",
".baz {
width: 5px;
}",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note they aren't hashed

Copy link
Member

Choose a reason for hiding this comment

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

Why do not use index-loader-syntax-sass.modules.css? Because request here is index-loader-syntax-sass.css

Copy link
Contributor Author

@jquense jquense Mar 11, 2021

Choose a reason for hiding this comment

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

that wouldn't illustrate the problem. css-loader only looks at the resourcePath, not the matchResource. My goal for using this syntax is as an alternative to virtual files. ideally i'd want this to work in the case where there is no resourcePath

Copy link
Contributor Author

Choose a reason for hiding this comment

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

e.g. having this button.module.scss!=!./base64-loader/index.js?[ident] work, at least from what Tobias suggested in the other issue. adding a resource to the end is just a hack to get something working

Copy link
Member

Choose a reason for hiding this comment

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

I think we can't do it, because button.module.scss can be any format...

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

What about button2.module.css?modules=true!=!./my-loader/!.button.js?

Copy link
Member

Choose a reason for hiding this comment

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

You can implement modules on own side

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like reimplement it? I could do that, but it's a lot of work. The hope/goal was to use the users existing config. If we need to reimplement css-loader, I can avoid all of this and write the whole thing as a plugin probably but that's more config and more duplicated work. It also doesn't solve the problem for anyone else trying to use virtual modules in this way, like svelte

Copy link
Contributor Author

@jquense jquense Mar 14, 2021

Choose a reason for hiding this comment

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

the specific hard part of that plan is when there are things in front of css-loader:

button2.module.scss!=!./my-loader?modules=true!.button.js

resolves fully to:

css-loader!sass-loader!my-loader?modules!./button.js

my-loader can't do modules at it's spot because Sass still needs to run. my loader also can't enable modules on the lower css-loader because it would change the option for all files. The only thing it can is something like: webpack/webpack#10350 which i say works great, but have since realized does not work well at scale for a few, hard to describe, reasons that causes styles to be included multiple times and out of order, due to module id's being (correctly) different between the plain require and compiled requires

Array [
"button.module.scss!=!./base64-loader/index.js?[ident]!./simple.js",
".foo {
color: red;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto

@codecov
Copy link

codecov bot commented Mar 11, 2021

Codecov Report

Merging #1273 (51f866f) into master (c13f369) will decrease coverage by 0.26%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1273      +/-   ##
==========================================
- Coverage   99.46%   99.20%   -0.27%     
==========================================
  Files          11       11              
  Lines         752      752              
  Branches      256      256              
==========================================
- Hits          748      746       -2     
- Misses          4        6       +2     
Impacted Files Coverage Δ
src/utils.js 98.15% <0.00%> (-0.62%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c13f369...51f866f. Read the comment docs.

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.

2 participants