FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
wordpress-development/scripts/webpack.dev.js at master · codekraft-studio/wordpress-development · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
codekraft-studio
/
wordpress-development
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
wordpress-development
/
scripts
/
webpack.dev.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
61 lines (53 loc) · 1.44 KB
Breadcrumbs
wordpress-development
/
scripts
/
webpack.dev.js
Copy path
File metadata and controls
executable file
·
61 lines (53 loc) · 1.44 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const
fs
=
require
(
'fs'
)
;
const
path
=
require
(
'path'
)
;
const
webpack
=
require
(
'webpack'
)
;
const
compiler
=
require
(
'./webpack.base'
)
.
compiler
;
const
env
=
require
(
'dotenv'
)
.
parse
(
fs
.
readFileSync
(
path
.
resolve
(
__dirname
,
'../.env'
)
)
)
const
hostname
=
(
env
.
HOSTNAME
&&
env
.
HOSTNAME
!==
''
)
?
`
${
env
.
HOSTNAME
}
`
:
'localhost'
const
port
=
(
hostname
===
'localhost'
)
?
`
${
(
env
.
PORT
||
8080
)
}
`
:
''
const
devPort
=
env
.
DEVPORT
||
8088
const
computedHostname
=
`
${
hostname
}
:
${
port
}
`
// Set proxy configurations to access WordPress
const
proxyConfig
=
{
target
:
`http://
${
computedHostname
}
`
,
ignorePath
:
false
,
changeOrigin
:
true
,
secure
:
false
}
;
// Override process.env variables
// since they may be used in other files
for
(
let
k
in
env
)
{
if
(
env
[
k
]
===
''
)
{
delete
process
.
env
[
k
]
}
else
{
process
.
env
[
k
]
=
env
[
k
]
}
}
// Ensure context is set to root folder
compiler
.
context
=
path
.
join
(
__dirname
,
'../'
)
;
// Set source map for development mode
compiler
.
devtool
=
'eval-source-map'
;
// Development server configuration
compiler
.
devServer
=
{
publicPath
:
`/wp-content/themes/theme/assets`
,
proxy
:
{
'/'
:
proxyConfig
,
'**'
:
proxyConfig
}
,
port
:
devPort
}
;
// Add environment variable for conditional requires
compiler
.
plugins
.
push
(
new
webpack
.
EnvironmentPlugin
(
{
NODE_ENV
:
'development'
,
DEBUG
:
true
,
HOSTNAME
:
computedHostname
,
DEVPORT
:
devPort
}
)
)
;
// Export new webpack settings
module
.
exports
=
compiler
;
Back
|
FazBrowse Home
|
New Git URL