Skip to content

Instantly share code, notes, and snippets.

@tedshd
Last active October 17, 2016 10:36
Show Gist options
  • Select an option

  • Save tedshd/7d9bd40d1813b11ecb2dcda5283da3f5 to your computer and use it in GitHub Desktop.

Select an option

Save tedshd/7d9bd40d1813b11ecb2dcda5283da3f5 to your computer and use it in GitHub Desktop.
webpack bundle js
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(1);
__webpack_require__(2);
module.exports = __webpack_require__(3);
/***/ },
/* 1 */
/***/ function(module, exports) {
console.log('lib_a');
a = 'a';
/***/ },
/* 2 */
/***/ function(module, exports) {
console.log('lib_b');
// console.log(a);
/***/ },
/* 3 */
/***/ function(module, exports) {
var cats = ['dave', 'henry', 'martha'];
module.exports = cats;
/***/ }
/******/ ]);
const webpack = require('webpack');
const url = './src/';
module.exports = {
entry: {
app: ['./src/lib_b.js', './src/lib_a.js'],
all: ['./src/lib_a.js', './src/lib_b.js', url + 'cats.js'],
mode: [url + 'app.js', url + 'app1.js'],
index: ['./src/style.js']
},
output: {
filename: '[name].js',
path: './built'
},
module: {
loaders: [
{ test: /\.css$/, loader: "style!css" }
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment