Sunday, 9 April 2017

"Webpack Var Injection" injects the wrong values

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?



via Alexander Mills

No comments:

Post a Comment