-
-
Notifications
You must be signed in to change notification settings - Fork 609
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
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -675,7 +675,7 @@ Array [ | |
"", | ||
], | ||
Array [ | ||
"plain.scss!=!../../src/index.js?[ident]!./index-loader-syntax-sass.css", | ||
"button.modules.css!=!./index-loader-syntax-sass.css", | ||
".baz { | ||
width: 5px; | ||
}", | ||
|
@@ -733,6 +733,20 @@ Array [ | |
"./index-loader-syntax.css", | ||
".a { | ||
color: red; | ||
}", | ||
"", | ||
], | ||
Array [ | ||
"button.modules.css!=!./index-loader-syntax-sass.css", | ||
".baz { | ||
width: 5px; | ||
}", | ||
"", | ||
], | ||
Array [ | ||
"button.module.scss!=!./base64-loader/index.js?[ident]!./simple.js", | ||
".foo { | ||
color: red; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
}", | ||
"", | ||
], | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = function loader(content) { | ||
console.log(Buffer.from(this.query.slice(1), 'base64').toString('ascii')) | ||
return Buffer.from(this.query.slice(1), 'base64').toString('ascii'); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import css from './index-loader-syntax.css'; | ||
|
||
__export__ = css; | ||
import styles from 'button.modules.css!=!./index-loader-syntax-sass.css' | ||
|
||
export default css; | ||
// the base64 decodes to ".foo { color: red; }" | ||
import styles2 from './button.module.scss!=!./base64-loader?LmZvbyB7IGNvbG9yOiByZWQ7IH0=!./simple.js' | ||
|
||
|
||
__export__ = [...css, ...styles, ...styles2]; | ||
|
||
export default css; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
note they aren't hashed
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.
Why do not use
index-loader-syntax-sass.modules.css
? Because request here isindex-loader-syntax-sass.css
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.
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
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.
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 workingThere 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.
I think we can't do it, because
button.module.scss
can be any format...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.
due this https://github.com/webpack-contrib/css-loader/blob/master/src/utils.js#L73
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.
What about
button2.module.css?modules=true!=!./my-loader/!.button.js
?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.
You can implement
modules
on own sideThere 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.
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
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.
the specific hard part of that plan is when there are things in front of css-loader:
resolves fully to:
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 moduleid
's being (correctly) different between the plain require and compiled requires