-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
fix(next@15): use the asset prefix when loading a CSS in App Router #72095
Merged
ijjk
merged 5 commits into
vercel:canary
from
noreiller:fix-dynamic-css-with-asset-prefix
Dec 12, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6df6f06
fix(next): use the asset prefix when loading a CSS in App Router
noreiller 619a7e6
fix: use href with no URL transformation
noreiller c0f1521
Merge branch 'canary' into fix-dynamic-css-with-asset-prefix
ijjk 761a02c
fix: only use the full URL when the asset origin is not the same than…
noreiller 7992f33
Merge branch 'canary' into fix-dynamic-css-with-asset-prefix
ijjk 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 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
3 changes: 3 additions & 0 deletions
3
test/integration/next-dynamic-css-asset-prefix/next.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,3 @@ | ||
module.exports = { | ||
assetPrefix: 'http://localhost:__CDN_PORT__/path-prefix', | ||
} |
27 changes: 27 additions & 0 deletions
27
test/integration/next-dynamic-css-asset-prefix/src/Component2.jsx
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,27 @@ | ||
import styles from './Component2.module.scss' | ||
|
||
export default function Content2() { | ||
return ( | ||
<div className={styles.container}> | ||
<h1 className={styles.header}>Where does it come from?</h1> | ||
<div className={styles.textContent}> | ||
Contrary to popular belief, Lorem Ipsum is not simply random text. It | ||
has roots in a piece of classical Latin literature from 45 BC, making it | ||
over 2000 years old. Richard McClintock, a Latin professor at | ||
Hampden-Sydney College in Virginia, looked up one of the more obscure | ||
Latin words, consectetur, from a Lorem Ipsum passage, and going through | ||
the cites of the word in classical literature, discovered the | ||
undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 | ||
of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by | ||
Cicero, written in 45 BC. This book is a treatise on the theory of | ||
ethics, very popular during the Renaissance. The first line of Lorem | ||
Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section | ||
1.10.32. The standard chunk of Lorem Ipsum used since the 1500s is | ||
reproduced below for those interested. Sections 1.10.32 and 1.10.33 from | ||
"de Finibus Bonorum et Malorum" by Cicero are also reproduced in their | ||
exact original form, accompanied by English versions from the 1914 | ||
translation by H. Rackham. | ||
</div> | ||
</div> | ||
) | ||
} |
13 changes: 13 additions & 0 deletions
13
test/integration/next-dynamic-css-asset-prefix/src/Component2.module.scss
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,13 @@ | ||
.header { | ||
font-style: italic; | ||
} | ||
|
||
.container { | ||
background-color: #dddddd; | ||
padding: 1rem; | ||
} | ||
|
||
.textContent { | ||
color: #666; | ||
letter-spacing: -1px; | ||
} |
29 changes: 29 additions & 0 deletions
29
test/integration/next-dynamic-css-asset-prefix/src/Content.jsx
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,29 @@ | ||
import styles from './Content.module.css' | ||
import Content2 from './Component2' | ||
|
||
export default function Content() { | ||
return ( | ||
<div className={styles.container}> | ||
<h1 className={styles.header}>Where does it come from?</h1> | ||
<div className={styles.textContent}> | ||
Contrary to popular belief, Lorem Ipsum is not simply random text. It | ||
has roots in a piece of classical Latin literature from 45 BC, making it | ||
over 2000 years old. Richard McClintock, a Latin professor at | ||
Hampden-Sydney College in Virginia, looked up one of the more obscure | ||
Latin words, consectetur, from a Lorem Ipsum passage, and going through | ||
the cites of the word in classical literature, discovered the | ||
undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 | ||
of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by | ||
Cicero, written in 45 BC. This book is a treatise on the theory of | ||
ethics, very popular during the Renaissance. The first line of Lorem | ||
Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section | ||
1.10.32. The standard chunk of Lorem Ipsum used since the 1500s is | ||
reproduced below for those interested. Sections 1.10.32 and 1.10.33 from | ||
"de Finibus Bonorum et Malorum" by Cicero are also reproduced in their | ||
exact original form, accompanied by English versions from the 1914 | ||
translation by H. Rackham. | ||
</div> | ||
<Content2 /> | ||
</div> | ||
) | ||
} |
13 changes: 13 additions & 0 deletions
13
test/integration/next-dynamic-css-asset-prefix/src/Content.module.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,13 @@ | ||
.header { | ||
font-style: italic; | ||
} | ||
|
||
.container { | ||
background-color: #dddddd; | ||
padding: 1rem; | ||
} | ||
|
||
.textContent { | ||
color: #666; | ||
letter-spacing: -1px; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
@sokra @ijjk I updated the fix to avoid a regression when the
assetPrefix
config is not used. I used the same kind of check than in theMiniCssExtractPlugin
webpack plugin.