Skip to content

Instantly share code, notes, and snippets.

@tricoder42
Last active June 23, 2017 16:49
Show Gist options
  • Save tricoder42/081ee071373835e001afc7212ff71e69 to your computer and use it in GitHub Desktop.
Save tricoder42/081ee071373835e001afc7212ff71e69 to your computer and use it in GitHub Desktop.
Removing development files from bundle
// load() call is removed, but import remains there
!function(modules) {
function __webpack_require__(moduleId) {
if (installedModules[moduleId]) return installedModules[moduleId].exports;
var module = installedModules[moduleId] = {
i: moduleId,
l: !1,
exports: {}
};
return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__),
module.l = !0, module.exports;
}
var installedModules = {};
__webpack_require__.m = modules, __webpack_require__.c = installedModules, __webpack_require__.d = function(exports, name, getter) {
__webpack_require__.o(exports, name) || Object.defineProperty(exports, name, {
configurable: !1,
enumerable: !0,
get: getter
});
}, __webpack_require__.n = function(module) {
var getter = module && module.__esModule ? function() {
return module.default;
} : function() {
return module;
};
return __webpack_require__.d(getter, "a", getter), getter;
}, __webpack_require__.o = function(object, property) {
return Object.prototype.hasOwnProperty.call(object, property);
}, __webpack_require__.p = "", __webpack_require__(__webpack_require__.s = "./test.js");
}({
"./test.js": function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", {
value: !0
}), __webpack_require__.d(__webpack_exports__, "main", function() {
return main;
});
var main = (__webpack_require__("./very.large.js"), function() {
});
},
"./very.large.js": function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_exports__.a = function() {
return "VERY LARGE";
};
}
});
Hash: 829e853f6a502b8cc064
Version: webpack 3.0.0
Time: 3809ms
Asset Size Chunks Chunk Names
./test.js 722 bytes 0 [emitted] test
[./test.js] ./test.js 174 bytes {0} [built]
[./very.large.js] ./very.large.js 56 bytes {0} [built]
WARNING in ./test.js from UglifyJs
Dropping __PURE__ call [./test.js:81,24]
Dropping side-effect-free statement [./test.js:80,2]
Side effects in initialization of unused variable __WEBPACK_IMPORTED_MODULE_0__very_large__ [./test.js:74,25]
// This import should be dropped in production,
// because it's very large and contains development data
// (like locales for all languages).
import load from './very.large'
export const main = () => {
let data = {}
if (process.env.NODE_ENV !== 'development') {
data = /*#__PURE__*/load()
}
}
export default () => 'VERY LARGE'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment