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
b8f336c7
Commit
b8f336c7
authored
May 13, 2017
by
Tim Neutkens
Committed by
Arunoda Susiripala
May 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add custom webpack dev middleware config (#1931)
parent
3306262b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
5 deletions
+19
-5
readme.md
readme.md
+9
-3
config.js
server/config.js
+1
-0
hot-reloader.js
server/hot-reloader.js
+9
-2
No files found.
readme.md
View file @
b8f336c7
...
...
@@ -682,9 +682,15 @@ In order to extend our usage of `webpack`, you can define a function that extend
module
.
exports
=
{
webpack
:
(
config
,
{
dev
})
=>
{
// Perform customizations to config
// Important: return the modified config
// Perform customizations to webpack config
// Important: return the modified config
return
config
},
webpackDevMiddleware
:
(
config
)
=>
{
// Perform customizations to webpack dev middleware config
// Important: return the modified config
return
config
}
}
...
...
server/config.js
View file @
b8f336c7
...
...
@@ -5,6 +5,7 @@ const cache = new Map()
const
defaultConfig
=
{
webpack
:
null
,
webpackDevMiddleware
:
null
,
poweredByHeader
:
true
,
distDir
:
'.next'
,
assetPrefix
:
''
...
...
server/hot-reloader.js
View file @
b8f336c7
...
...
@@ -138,14 +138,21 @@ export default class HotReloader {
}
}
:
{}
this
.
webpackDevMiddleware
=
webpackDevMiddleware
(
compiler
,
{
let
webpackDevMiddlewareConfig
=
{
publicPath
:
'/_next/webpack/'
,
noInfo
:
true
,
quiet
:
true
,
clientLogLevel
:
'warning'
,
watchOptions
:
{
ignored
},
...
windowsSettings
})
}
if
(
this
.
config
.
webpackDevMiddleware
)
{
console
.
log
(
'> Using "webpackDevMiddleware" config function defined in next.config.js.'
)
webpackDevMiddlewareConfig
=
this
.
config
.
webpackDevMiddleware
(
webpackDevMiddlewareConfig
)
}
this
.
webpackDevMiddleware
=
webpackDevMiddleware
(
compiler
,
webpackDevMiddlewareConfig
)
this
.
webpackHotMiddleware
=
webpackHotMiddleware
(
compiler
,
{
path
:
'/_next/webpack-hmr'
,
...
...
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