webpack/examples/dll
Tobias Koppers 8e69a80847 code linting 2017-01-11 12:29:01 +01:00
..
README.md regenerated examples 2016-12-23 09:24:32 +01:00
a.js added DllPlugin and dll example 2015-05-16 18:27:59 +02:00
alpha.js added DllPlugin and dll example 2015-05-16 18:27:59 +02:00
b.js added DllPlugin and dll example 2015-05-16 18:27:59 +02:00
beta.js added DllPlugin and dll example 2015-05-16 18:27:59 +02:00
build.js added DllPlugin and dll example 2015-05-16 18:27:59 +02:00
c.jsx Supplying extensions when constructing DllReferencePlugin 2016-09-19 21:56:02 +02:00
template.md added DllReferencePlugin 2015-05-17 11:06:35 +02:00
webpack.config.js code linting 2017-01-11 12:29:01 +01:00

README.md

webpack.config.js

var path = require("path");
var webpack = require("../../");
module.exports = {
	resolve: {
		extensions: ['.js', '.jsx']
	},
	entry: {
		alpha: ["./alpha", "./a", "module"],
		beta: ["./beta", "./b", "./c"]
	},
	output: {
		path: path.join(__dirname, "js"),
		filename: "MyDll.[name].js",
		library: "[name]_[hash]"
	},
	plugins: [
		new webpack.DllPlugin({
			path: path.join(__dirname, "js", "[name]-manifest.json"),
			name: "[name]_[hash]"
		})
	]
};

js/MyDll.alpha.js

var alpha_282e8826843b2bb4eeb1 =
`/******/ (function(modules) { /* webpackBootstrap */ })` ``` 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] = { // i: moduleId, // l: false, // exports: {} // };

// // Execute the module function // modules[moduleId].call(module.exports, module, module.exports, webpack_require);

// // Flag the module as loaded // module.l = 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;

// // identity function for calling harmony imports with the correct context // webpack_require.i = function(value) { return value; };

// // define getter function for harmony exports // webpack_require.d = function(exports, name, getter) { // if(!webpack_require.o(exports, name)) { // Object.defineProperty(exports, name, { // configurable: false, // enumerable: true, // get: getter // }); // } // };

// // getDefaultExport function for compatibility with non-harmony modules // webpack_require.n = function(module) { // var getter = module && module.__esModule ? // function getDefault() { return module['default']; } : // function getModuleExports() { return module; }; // webpack_require.d(getter, 'a', getter); // return getter; // };

// // Object.prototype.hasOwnProperty.call // webpack_require.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };

// // webpack_public_path // webpack_require.p = "js/";

// // Load entry module and return exports // return webpack_require(webpack_require.s = 6); // }) /******************************************************************/

</details>
``` js
/******/ ([
/* 0 */
/* unknown exports provided */
/* all exports used */
/*!**************!*\
  !*** ./a.js ***!
  \**************/
/***/ function(module, exports) {

module.exports = "a";

/***/ },
/* 1 */
/* unknown exports provided */
/* all exports used */
/*!******************!*\
  !*** ./alpha.js ***!
  \******************/
/***/ function(module, exports) {

module.exports = "alpha";

/***/ },
/* 2 */,
/* 3 */,
/* 4 */,
/* 5 */
/* unknown exports provided */
/* all exports used */
/*!**********************!*\
  !*** ../~/module.js ***!
  \**********************/
/***/ function(module, exports) {

module.exports = "module";

/***/ },
/* 6 */
/* unknown exports provided */
/* all exports used */
/*!*****************!*\
  !*** dll alpha ***!
  \*****************/
/***/ function(module, exports, __webpack_require__) {

module.exports = __webpack_require__;

/***/ }
/******/ ]);

js/alpha-manifest.json

{
  "name": "alpha_282e8826843b2bb4eeb1",
  "content": {
    "./a.js": {
      "id": 0,
      "meta": {}
    },
    "./alpha.js": {
      "id": 1,
      "meta": {}
    },
    "../node_modules/module.js": {
      "id": 5,
      "meta": {}
    }
  }
}

Info

Uncompressed

Hash: 282e8826843b2bb4eeb1
Version: webpack 2.2.0-rc.2
         Asset     Size  Chunks             Chunk Names
 MyDll.beta.js  3.34 kB       0  [emitted]  beta
MyDll.alpha.js  3.36 kB       1  [emitted]  alpha
Entrypoint alpha = MyDll.alpha.js
Entrypoint beta = MyDll.beta.js
chunk    {0} MyDll.beta.js (beta) 80 bytes [entry] [rendered]
    > beta [7] dll beta 
    [2] ./b.js 21 bytes {0} [built]
        single entry ./b [7] dll beta
    [3] ./beta.js 24 bytes {0} [built]
        single entry ./beta [7] dll beta
    [4] ./c.jsx 23 bytes {0} [built]
        single entry ./c [7] dll beta
    [7] dll beta 12 bytes {0} [built]
chunk    {1} MyDll.alpha.js (alpha) 84 bytes [entry] [rendered]
    > alpha [6] dll alpha 
    [0] ./a.js 21 bytes {1} [built]
        single entry ./a [6] dll alpha
    [1] ./alpha.js 25 bytes {1} [built]
        single entry ./alpha [6] dll alpha
    [5] ../~/module.js 26 bytes {1} [built]
        single entry module [6] dll alpha
    [6] dll alpha 12 bytes {1} [built]

Minimized (uglify-js, no zip)

Hash: 282e8826843b2bb4eeb1
Version: webpack 2.2.0-rc.2
         Asset       Size  Chunks             Chunk Names
 MyDll.beta.js  653 bytes       0  [emitted]  beta
MyDll.alpha.js  657 bytes       1  [emitted]  alpha
Entrypoint alpha = MyDll.alpha.js
Entrypoint beta = MyDll.beta.js
chunk    {0} MyDll.beta.js (beta) 80 bytes [entry] [rendered]
    > beta [7] dll beta 
    [2] ./b.js 21 bytes {0} [built]
        single entry ./b [7] dll beta
    [3] ./beta.js 24 bytes {0} [built]
        single entry ./beta [7] dll beta
    [4] ./c.jsx 23 bytes {0} [built]
        single entry ./c [7] dll beta
    [7] dll beta 12 bytes {0} [built]
chunk    {1} MyDll.alpha.js (alpha) 84 bytes [entry] [rendered]
    > alpha [6] dll alpha 
    [0] ./a.js 21 bytes {1} [built]
        single entry ./a [6] dll alpha
    [1] ./alpha.js 25 bytes {1} [built]
        single entry ./alpha [6] dll alpha
    [5] ../~/module.js 26 bytes {1} [built]
        single entry module [6] dll alpha
    [6] dll alpha 12 bytes {1} [built]