-
-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
experimentalUseImportModule
works with new URL(...)
syntax
- Loading branch information
1 parent
e70a0a9
commit cf81c4b
Showing
172 changed files
with
832 additions
and
238 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -9,9 +9,6 @@ module.exports = { | |
use: [ | ||
{ | ||
loader: Self.loader, | ||
options: { | ||
publicPath: "", | ||
}, | ||
}, | ||
"css-loader", | ||
], | ||
|
File renamed without changes
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
test/cases/custom-loader-with-new-url-and-public-path-1/app/mockLoader.js
This file contains 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,12 @@ | ||
export default function loader() { | ||
const callback = this.async(); | ||
|
||
callback( | ||
null, | ||
`export default [ | ||
[module.id, ".foo {background: url(" + new URL("./img.png", import.meta.url) + ")}", ""], | ||
[module.id, ".bar {background: url(" + new URL("../outer-img.png", import.meta.url) + ")}", ""], | ||
[module.id, ".baz {background: url(" + new URL("./nested/nested-img.png", import.meta.url) + ")}", ""] | ||
]` | ||
); | ||
} |
File renamed without changes
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...ses/custom-loader-with-new-url-and-public-path-1/expected/webpack-5-importModule/main.css
This file contains 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,3 @@ | ||
.foo {background: url(public/img.png)} | ||
.bar {background: url(outer-img.png)} | ||
.baz {background: url(public/nested/nested-img.png)} |
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
test/cases/custom-loader-with-new-url-and-public-path-auto/app/mockLoader.js
This file contains 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,12 @@ | ||
export default function loader() { | ||
const callback = this.async(); | ||
|
||
callback( | ||
null, | ||
`export default [ | ||
[module.id, ".foo {background: url(" + new URL("./img.png", import.meta.url) + ")}", ""], | ||
[module.id, ".bar {background: url(" + new URL("../outer-img.png", import.meta.url) + ")}", ""], | ||
[module.id, ".baz {background: url(" + new URL("./nested/nested-img.png", import.meta.url) + ")}", ""] | ||
]` | ||
); | ||
} |
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
Binary file added
BIN
+76.3 KB
test/cases/custom-loader-with-new-url-and-public-path-default-auto/app/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
test/cases/custom-loader-with-new-url-and-public-path-default-auto/app/mockLoader.js
This file contains 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,12 @@ | ||
export default function loader() { | ||
const callback = this.async(); | ||
|
||
callback( | ||
null, | ||
`export default [ | ||
[module.id, ".foo {background: url(" + new URL("./img.png", import.meta.url) + ")}", ""], | ||
[module.id, ".bar {background: url(" + new URL("../outer-img.png", import.meta.url) + ")}", ""], | ||
[module.id, ".baz {background: url(" + new URL("./nested/nested-img.png", import.meta.url) + ")}", ""] | ||
]` | ||
); | ||
} |
Binary file added
BIN
+76.3 KB
...stom-loader-with-new-url-and-public-path-default-auto/app/nested/nested-img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
test/cases/custom-loader-with-new-url-and-public-path-default-auto/app/style.css
This file contains 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,3 @@ | ||
.class { | ||
background: red; | ||
} |
3 changes: 3 additions & 0 deletions
3
test/cases/custom-loader-with-new-url-and-public-path-default-auto/expected/main.css
This file contains 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,3 @@ | ||
.foo {background: url(img.png)} | ||
.bar {background: url(../outer-img.png)} | ||
.baz {background: url(nested/nested-img.png)} |
Binary file added
BIN
+76.3 KB
test/cases/custom-loader-with-new-url-and-public-path-default-auto/outer-img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions
28
test/cases/custom-loader-with-new-url-and-public-path-default-auto/webpack.config.js
This file contains 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,28 @@ | ||
import path from "path"; | ||
|
||
import Self from "../../../src"; | ||
|
||
module.exports = { | ||
entry: "./index.js", | ||
context: path.resolve(__dirname, "app"), | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [Self.loader, "./mockLoader"], | ||
}, | ||
{ | ||
test: /\.png$/, | ||
type: "asset/resource", | ||
generator: { | ||
filename: "[path][name][ext]", | ||
}, | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new Self({ | ||
filename: "[name].css", | ||
}), | ||
], | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
test/cases/custom-loader-with-new-url-and-public-path/app/mockLoader.js
This file contains 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,12 @@ | ||
export default function loader() { | ||
const callback = this.async(); | ||
|
||
callback( | ||
null, | ||
`export default [ | ||
[module.id, ".foo {background: url(" + new URL("./img.png", import.meta.url) + ")}", ""], | ||
[module.id, ".bar {background: url(" + new URL("../outer-img.png", import.meta.url) + ")}", ""], | ||
[module.id, ".baz {background: url(" + new URL("./nested/nested-img.png", import.meta.url) + ")}", ""] | ||
]` | ||
); | ||
} |
Binary file added
BIN
+76.3 KB
test/cases/custom-loader-with-new-url-and-public-path/app/nested/nested-img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
test/cases/custom-loader-with-new-url-and-public-path/app/style.css
This file contains 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,3 @@ | ||
.class { | ||
background: red; | ||
} |
3 changes: 3 additions & 0 deletions
3
...cases/custom-loader-with-new-url-and-public-path/expected/webpack-5-importModule/main.css
This file contains 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,3 @@ | ||
.foo {background: url(/public/img.png)} | ||
.bar {background: url(/outer-img.png)} | ||
.baz {background: url(/public/nested/nested-img.png)} |
3 changes: 3 additions & 0 deletions
3
test/cases/custom-loader-with-new-url-and-public-path/expected/webpack-5/main.css
This file contains 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,3 @@ | ||
.foo {background: url(/public/img.png)} | ||
.bar {background: url(/public/../outer-img.png)} | ||
.baz {background: url(/public/nested/nested-img.png)} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions
36
test/cases/custom-loader-with-new-url-and-public-path/webpack.config.js
This file contains 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,36 @@ | ||
import path from "path"; | ||
|
||
import Self from "../../../src"; | ||
|
||
module.exports = { | ||
entry: "./index.js", | ||
context: path.resolve(__dirname, "app"), | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
{ | ||
loader: Self.loader, | ||
options: { | ||
publicPath: "/public/", | ||
}, | ||
}, | ||
"./mockLoader", | ||
], | ||
}, | ||
{ | ||
test: /\.png$/, | ||
type: "asset/resource", | ||
generator: { | ||
filename: "[path][name][ext]", | ||
}, | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new Self({ | ||
filename: "[name].css", | ||
}), | ||
], | ||
}; |
This file contains 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
4 changes: 0 additions & 4 deletions
4
test/cases/js-hash/expected/webpack-5-importModule/style.17f5571b796a525cec79.1.css
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...rtModule/style.00aa669429946cee3d20.2.css → ...rtModule/style.cee668336e0f53d4ab8e.2.css
This file contains 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,5 @@ | ||
|
||
.dDtFvCqivX5dncL54de5D { | ||
.Z_E0RPEyV1Psn6SZX9qd { | ||
background: green; | ||
} | ||
|
4 changes: 4 additions & 0 deletions
4
test/cases/js-hash/expected/webpack-5-importModule/style.ff389914a5cf993f5135.1.css
This file contains 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 @@ | ||
.Z_E0RPEyV1Psn6SZX9qd { | ||
background: red; | ||
} | ||
|
5 changes: 0 additions & 5 deletions
5
test/cases/js-hash/expected/webpack-5/style.3e1ac9a6569d80b3d351.2.css
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
test/cases/js-hash/expected/webpack-5/style.5cacc352876577e35213.2.css
This file contains 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,5 @@ | ||
|
||
.Hm__zqGZU_G0Lp44yFFz { | ||
background: green; | ||
} | ||
|
4 changes: 0 additions & 4 deletions
4
test/cases/js-hash/expected/webpack-5/style.678e24a6a30ce54e924b.1.css
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
test/cases/js-hash/expected/webpack-5/style.8406295479af8ab6e76a.1.css
This file contains 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 @@ | ||
.Hm__zqGZU_G0Lp44yFFz { | ||
background: red; | ||
} | ||
|
12 changes: 0 additions & 12 deletions
12
test/cases/new-url-with-public-path-auto/app/mockLoader.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes
5 changes: 5 additions & 0 deletions
5
test/cases/publicpath-absolute-url-1/expected/webpack-5-importModule/main.css
This file contains 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,5 @@ | ||
body { | ||
background: red; | ||
background-image: url(https://webpack.js.org/foo/c9e192c015437a21dea1.svg); | ||
} | ||
|
File renamed without changes
Oops, something went wrong.
Replacement with DOUBLE_DOT_PATH_SEGMENT will never work