I really don't understand the point of WebPack, I read an intro here and a bunch of other tutorials, but it seems like I have to ask individual questions... I am following an example by creating 2 files of a basic site:
app.js:
document.write('welcome to my app');
console.log('app loaded');
index.html:
<html>
<body>
<script src="bundle.js"></script>
</body>
</html>
Then I run webpack ./app.js bundle.js from the CLI to create the bundle file, which happens.
So...how does the bundle file get used now? What is it? I thought it essentially compiled "everything" into a single file and then uglified it, but that doesn't seem to be the case, some of the ouput looks like this (edited to include full output):
/******/ (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) {
document.write('welcome to my app');
console.log('app loaded');
/***/ }
/******/ ]);
So, what's the point? Can the app run from this bundle file? Does the bundle get referenced somehow? Do I still need the original index.html and app.js files once the bundle is built?
webpack.config.js