“Webpack Var Injection” injects the wrong values

341
April 10, 2017, at 11:35 AM

I see this in the console:

/* 469 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */ (function(global, console) {
'use strict';
//core
var path = __webpack_require__(20);
var assert = __webpack_require__(5);
var fs = __webpack_require__(30);
var util = __webpack_require__(1);
//npm
var colors = __webpack_require__(9);
//project
var sumanUtils = __webpack_require__(13);
var constants = __webpack_require__(10);
////////////////////////////////////////////////////////////////////////////////////
var loaded;
module.exports = function loadSharedObjects(pathObj, projectRoot) {
  if (loaded) {
    return loaded;
  }
  if (global.sumanOpts.init) {
    return loaded = {};
  }

as you can see, it's wrapping my code, and injecting both global and console...however, I don't really want Webpack to inject these variables, because apparently Webpack is injecting the wrong values for these.

How can I get Webpack to use

__webpack_require__ 

to source global and console?

The exact problem is that global.sumanOpts is undefined, and so I get an error saying that it cannot read property "init" of undefined. And that's why I am fairly certain that Webpack is not injecting the right value for global.

Rent Charter Buses Company
READ ALSO
Is it fine to assign express js application instance to global scope?

Is it fine to assign express js application instance to global scope?

I am making my own node js structure and i am using express for http serverI also saw few other structures like loopback and sails

310
MySQL update trigger works but SELECT query does not see new data

MySQL update trigger works but SELECT query does not see new data

I have a MYSQL trigger that updates a table based upon the insert on another tableThe updates are working correctly and I can see them from MYSQL workbench

366
What is the difference between worker.kill vs process.exit in Node.JS

What is the difference between worker.kill vs process.exit in Node.JS

When using Nodejs's cluster feature, what is the difference between ending a forked process with process

312
FFmpeg stream dynamic png

FFmpeg stream dynamic png

I would like to know if its possible to stream a png or any kind of image using ffmpegI would like to generate the image contiously using nodejs that updates every 10 seconds

463