Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
a56d9a91
Commit
a56d9a91
authored
Dec 26, 2019
by
Joe Haddad
Committed by
JJ Kasper
Dec 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do Not Run File Loader on Server (#9843)
parent
6b50b132
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
21 deletions
+23
-21
index.ts
packages/next/build/webpack/config/blocks/css/index.ts
+23
-21
No files found.
packages/next/build/webpack/config/blocks/css/index.ts
View file @
a56d9a91
...
@@ -230,29 +230,31 @@ export const css = curry(async function css(
...
@@ -230,29 +230,31 @@ export const css = curry(async function css(
})
})
)
)
// Automatically transform references to files (i.e. url()) into URLs
if
(
ctx
.
isClient
)
{
// e.g. url(./logo.svg)
// Automatically transform references to files (i.e. url()) into URLs
fns
.
push
(
// e.g. url(./logo.svg)
loader
({
fns
.
push
(
oneOf
:
[
loader
({
{
oneOf
:
[
// This should only be applied to CSS files
{
issuer
:
{
test
:
/
\.
css$/
},
// This should only be applied to CSS files
// Exclude extensions that webpack handles by default
issuer
:
{
test
:
/
\.
css$/
},
exclude
:
[
/
\.(
js|mjs|jsx|ts|tsx
)
$/
,
/
\.
html$/
,
/
\.
json$/
],
// Exclude extensions that webpack handles by default
use
:
{
exclude
:
[
/
\.(
js|mjs|jsx|ts|tsx
)
$/
,
/
\.
html$/
,
/
\.
json$/
],
// `file-loader` always emits a URL reference, where `url-loader`
use
:
{
// might inline the asset as a data URI
// `file-loader` always emits a URL reference, where `url-loader`
loader
:
require
.
resolve
(
'file-loader'
),
// might inline the asset as a data URI
options
:
{
loader
:
require
.
resolve
(
'file-loader'
),
// Hash the file for immutable cacheability
options
:
{
name
:
'static/media/[name].[hash].[ext]'
,
// Hash the file for immutable cacheability
name
:
'static/media/[name].[hash].[ext]'
,
},
},
},
},
},
}
,
]
,
],
})
}
)
)
)
}
const
fn
=
pipe
(...
fns
)
const
fn
=
pipe
(...
fns
)
return
fn
(
config
)
return
fn
(
config
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment