FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
webpack/lib/EnvironmentPlugin.js at master · codeinvain/webpack · GitHub
codeinvain
webpack
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
webpack
/
lib
/
EnvironmentPlugin.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (23 loc) · 857 Bytes
Breadcrumbs
webpack
/
lib
/
EnvironmentPlugin.js
Copy path
File metadata and controls
28 lines (23 loc) · 857 Bytes
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
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Simen Brekken @simenbrekken
*/
var
DefinePlugin
=
require
(
"./DefinePlugin"
)
;
function
EnvironmentPlugin
(
keys
)
{
this
.
keys
=
Array
.
isArray
(
keys
)
?
keys
:
Array
.
prototype
.
slice
.
call
(
arguments
)
;
}
module
.
exports
=
EnvironmentPlugin
;
EnvironmentPlugin
.
prototype
.
apply
=
function
(
compiler
)
{
compiler
.
apply
(
new
DefinePlugin
(
this
.
keys
.
reduce
(
function
(
definitions
,
key
)
{
var
value
=
process
.
env
[
key
]
;
if
(
value
===
undefined
)
{
compiler
.
plugin
(
"this-compilation"
,
function
(
compilation
)
{
var
error
=
new
Error
(
key
+
" environment variable is undefined."
)
;
error
.
name
=
"EnvVariableNotDefinedError"
;
compilation
.
warnings
.
push
(
error
)
;
}
)
;
}
definitions
[
"process.env."
+
key
]
=
value
?
JSON
.
stringify
(
value
)
:
"undefined"
;
return
definitions
;
}
,
{
}
)
)
)
;
}
;
Back
|
FazBrowse Home
|
New Git URL