File tree Expand file tree Collapse file tree 12 files changed +188
-0
lines changed
packages/next/build/webpack/config/blocks/css/loaders
css-fixtures/unresolved-css-url Expand file tree Collapse file tree 12 files changed +188
-0
lines changed Original file line number Diff line number Diff line change
1
+ export function cssFileResolve ( url : string , _resourcePath : string ) {
2
+ if ( url . startsWith ( '/' ) ) {
3
+ return false
4
+ }
5
+ return true
6
+ }
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import postcss from 'postcss'
2
2
import webpack from 'webpack'
3
3
import { ConfigurationContext } from '../../../utils'
4
4
import { getClientStyleLoader } from './client'
5
+ import { cssFileResolve } from './file-resolve'
5
6
6
7
export function getGlobalCssLoader (
7
8
ctx : ConfigurationContext ,
@@ -29,6 +30,9 @@ export function getGlobalCssLoader(
29
30
sourceMap : true ,
30
31
// Next.js controls CSS Modules eligibility:
31
32
modules : false ,
33
+ url : cssFileResolve ,
34
+ import : ( url : string , _ : any , resourcePath : string ) =>
35
+ cssFileResolve ( url , resourcePath ) ,
32
36
} ,
33
37
} )
34
38
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import postcss from 'postcss'
2
2
import webpack from 'webpack'
3
3
import { ConfigurationContext } from '../../../utils'
4
4
import { getClientStyleLoader } from './client'
5
+ import { cssFileResolve } from './file-resolve'
5
6
import { getCssModuleLocalIdent } from './getCssModuleLocalIdent'
6
7
7
8
export function getCssModuleLoader (
@@ -30,6 +31,9 @@ export function getCssModuleLoader(
30
31
sourceMap : true ,
31
32
// Use CJS mode for backwards compatibility:
32
33
esModule : false ,
34
+ url : cssFileResolve ,
35
+ import : ( url : string , _ : any , resourcePath : string ) =>
36
+ cssFileResolve ( url , resourcePath ) ,
33
37
modules : {
34
38
// Do not transform class names (CJS mode backwards compatibility):
35
39
exportLocalsConvention : 'asIs' ,
Original file line number Diff line number Diff line change
1
+ p {
2
+ background-image : url ('/vercel.svg' );
3
+ }
4
+
5
+ p : nth-child (1 ) {
6
+ background-image : url (/vercel.svg);
7
+ }
8
+
9
+ /* p:nth-child(2) {
10
+ background-image: url('./vercel.svg');
11
+ }
12
+
13
+ p:nth-child(3) {
14
+ background-image: url(./vercel.svg);
15
+ } */
16
+
17
+ p : nth-child (4 ) {
18
+ background-image : url ('./public/vercel.svg' );
19
+ }
20
+
21
+ p : nth-child (5 ) {
22
+ background-image : url(./ public/vercel.svg);
23
+ }
24
+
25
+ div {
26
+ background-image : url ('https://vercel.com/vercel.svg' );
27
+ }
28
+
29
+ div : nth-child (1 ) {
30
+ background-image : url ('https://vercel.com/vercel.svg' );
31
+ }
Original file line number Diff line number Diff line change
1
+ .p {
2
+ background-image : url (' /vercel.svg' );
3
+ }
4
+
5
+ .p :nth-child (1 ) {
6
+ background-image : url (/ vercel.svg );
7
+ }
8
+
9
+ // .p:nth-child(2) {
10
+ // background-image: url('./vercel.svg');
11
+ // }
12
+
13
+ // .p:nth-child(3) {
14
+ // background-image: url(./vercel.svg);
15
+ // }
16
+
17
+ p :nth-child (4 ) {
18
+ background-image : url (' ./public/vercel.svg' );
19
+ }
20
+
21
+ p :nth-child (5 ) {
22
+ background-image : url (./public/vercel.svg );
23
+ }
24
+
25
+ .div {
26
+ background-image : url (' https://vercel.com/vercel.svg' );
27
+ }
28
+
29
+ .div :nth-child (1 ) {
30
+ background-image : url (' https://vercel.com/vercel.svg' );
31
+ }
Original file line number Diff line number Diff line change
1
+ import '../global.css'
2
+ import '../global.scss'
3
+
4
+ export default function MyApp ( { Component, pageProps } ) {
5
+ return < Component { ...pageProps } />
6
+ }
Original file line number Diff line number Diff line change
1
+ import styles from './another.module.scss'
2
+
3
+ export default function Page ( ) {
4
+ return < p className = { styles . first } > Hello from index</ p >
5
+ }
Original file line number Diff line number Diff line change
1
+ .first {
2
+ background-image : url (' /vercel.svg' );
3
+ }
4
+
5
+ .first :nth-child (1 ) {
6
+ background-image : url (/ vercel.svg );
7
+ }
8
+
9
+ // .first:nth-child(2) {
10
+ // background-image: url('./vercel.svg');
11
+ // }
12
+
13
+ // .first:nth-child(3) {
14
+ // background-image: url(./vercel.svg);
15
+ // }
16
+
17
+ .first :nth-child (4 ) {
18
+ background-image : url (' ../public/vercel.svg' );
19
+ }
20
+
21
+ .first :nth-child (5 ) {
22
+ background-image : url (../public/vercel.svg );
23
+ }
24
+
25
+ .another {
26
+ background-image : url (' https://vercel.com/vercel.svg' );
27
+ }
28
+
29
+ .another :nth-child (1 ) {
30
+ background-image : url (' https://vercel.com/vercel.svg' );
31
+ }
Original file line number Diff line number Diff line change
1
+ import styles from './index.module.css'
2
+
3
+ export default function Page ( ) {
4
+ return < p className = { styles . first } > Hello from index</ p >
5
+ }
Original file line number Diff line number Diff line change
1
+ .first {
2
+ background-image : url ('/vercel.svg' );
3
+ }
4
+
5
+ .first : nth-child (1 ) {
6
+ background-image : url (/vercel.svg);
7
+ }
8
+
9
+ /* .first:nth-child(2) {
10
+ background-image: url('./vercel.svg');
11
+ }
12
+
13
+ .first:nth-child(3) {
14
+ background-image: url(./vercel.svg);
15
+ } */
16
+
17
+ .first : nth-child (4 ) {
18
+ background-image : url ('../public/vercel.svg' );
19
+ }
20
+
21
+ .first : nth-child (5 ) {
22
+ background-image : url(../ public/vercel.svg);
23
+ }
24
+
25
+ .another {
26
+ background-image : url ('https://vercel.com/vercel.svg' );
27
+ }
28
+
29
+ .another : nth-child (1 ) {
30
+ background-image : url ('https://vercel.com/vercel.svg' );
31
+ }
You can’t perform that action at this time.
0 commit comments