-
-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: crash when
publicPath
is function (#881)
- Loading branch information
1 parent
0651fa5
commit 41bd828
Showing
11 changed files
with
79 additions
and
7 deletions.
There are no files selected for viewing
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
1 change: 1 addition & 0 deletions
1
.../publicpath-function-2/expected/webpack-5-importModule/c9e192c015437a21dea1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
test/cases/publicpath-function-2/expected/webpack-5-importModule/nested/again/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,5 @@ | ||
body { | ||
background: green; | ||
background-image: url(http://example.com/XXXX/c9e192c015437a21dea1.svg); | ||
} | ||
|
5 changes: 5 additions & 0 deletions
5
test/cases/publicpath-function-2/expected/webpack-5-importModule/nested/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,5 @@ | ||
body { | ||
background: red; | ||
background-image: url(http://example.com/XXXX/c9e192c015437a21dea1.svg); | ||
} | ||
|
1 change: 1 addition & 0 deletions
1
test/cases/publicpath-function-2/expected/webpack-5/c9e192c015437a21dea1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
test/cases/publicpath-function-2/expected/webpack-5/nested/again/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,5 @@ | ||
body { | ||
background: green; | ||
background-image: url(http://example.com/4d869bb95ecdf3f870fb/c9e192c015437a21dea1.svg); | ||
} | ||
|
5 changes: 5 additions & 0 deletions
5
test/cases/publicpath-function-2/expected/webpack-5/nested/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,5 @@ | ||
body { | ||
background: red; | ||
background-image: url(http://example.com/ca6e489a6807af3e778c/c9e192c015437a21dea1.svg); | ||
} | ||
|
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 @@ | ||
body { | ||
background: green; | ||
background-image: url(../../react.svg); | ||
} |
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 @@ | ||
body { | ||
background: red; | ||
background-image: url(../react.svg); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,32 @@ | ||
import Self from "../../../src"; | ||
|
||
module.exports = { | ||
entry: { | ||
// Specific CSS entry point, with output to a nested folder | ||
"nested/style": "./nested/style.css", | ||
// Note that relative nesting of output is the same as that of the input | ||
"nested/again/style": "./nested/again/style.css", | ||
}, | ||
output: { | ||
// Compute publicPath relative to the CSS output | ||
publicPath: (pathData) => `http://example.com/${pathData.hash}/`, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
{ | ||
loader: Self.loader, | ||
}, | ||
"css-loader", | ||
], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new Self({ | ||
filename: "[name].css", | ||
}), | ||
], | ||
}; |