Skip to content

Commit 8d16ea2

Browse files
authored
Moved querying of environment variable
This fixes issues when environment variable is not configured before importing the module... which can be true for I figure a lot of Webpack configuration generators/factories like [edge-builder](https://github.com/sebastian-software/edge-builder). It imports dependencies via ESM import and executes the `main` function afterwards to parse command line arguments, etc.
1 parent 1d71e97 commit 8d16ea2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

loader.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ var SingleEntryPlugin = require("webpack/lib/SingleEntryPlugin");
1313
var LimitChunkCountPlugin = require("webpack/lib/optimize/LimitChunkCountPlugin");
1414

1515
var NS = fs.realpathSync(__dirname);
16-
var DEV = process.env.NODE_ENV === 'development'
1716

1817
module.exports = function(source) {
1918
return source;
@@ -133,7 +132,7 @@ module.exports.pitch = function(request) {
133132
//
134133
// All we need is a date that changes during dev, to trigger a reload since
135134
// hashes generated based on the file contents are what trigger HMR.
136-
if (DEV) {
135+
if (process.env.NODE_ENV === 'development') {
137136
resultSource += `
138137
if (module.hot) {
139138
module.hot.accept();

0 commit comments

Comments
 (0)