diff --git a/examples/rebuild.js b/examples/build-examples.js similarity index 99% rename from examples/rebuild.js rename to examples/build-examples.js index 2d98200..563224c 100644 --- a/examples/rebuild.js +++ b/examples/build-examples.js @@ -4,7 +4,6 @@ * You could do the same by going into each example and execute * `webpack` */ - var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; var fs = require('fs'); diff --git a/examples/inline/dist/bundle.js b/examples/inline/dist/webpack-1/bundle.js similarity index 100% rename from examples/inline/dist/bundle.js rename to examples/inline/dist/webpack-1/bundle.js diff --git a/examples/inline/dist/favicon.ico b/examples/inline/dist/webpack-1/favicon.ico similarity index 100% rename from examples/inline/dist/favicon.ico rename to examples/inline/dist/webpack-1/favicon.ico diff --git a/examples/inline/dist/index.html b/examples/inline/dist/webpack-1/index.html similarity index 100% rename from examples/inline/dist/index.html rename to examples/inline/dist/webpack-1/index.html diff --git a/examples/inline/dist/styles.css b/examples/inline/dist/webpack-1/styles.css similarity index 100% rename from examples/inline/dist/styles.css rename to examples/inline/dist/webpack-1/styles.css diff --git a/examples/inline/dist/webpack-2/bundle.js b/examples/inline/dist/webpack-2/bundle.js new file mode 100644 index 0000000..f5d58df --- /dev/null +++ b/examples/inline/dist/webpack-2/bundle.js @@ -0,0 +1,60 @@ +/******/ (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].e; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ e: {}, +/******/ i: moduleId, +/******/ l: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.e, module, module.e, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.l = true; + +/******/ // Return the exports of the module +/******/ return module.e; +/******/ } + + +/******/ // 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__(__webpack_require__.s = 1); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports) { + + // removed by extract-text-webpack-plugin + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + __webpack_require__(0); + + console.log('Hello World'); + + +/***/ } +/******/ ]); \ No newline at end of file diff --git a/examples/inline/dist/webpack-2/favicon.ico b/examples/inline/dist/webpack-2/favicon.ico new file mode 100644 index 0000000..be74abd Binary files /dev/null and b/examples/inline/dist/webpack-2/favicon.ico differ diff --git a/examples/inline/dist/webpack-2/index.html b/examples/inline/dist/webpack-2/index.html new file mode 100644 index 0000000..bd971c9 --- /dev/null +++ b/examples/inline/dist/webpack-2/index.html @@ -0,0 +1,62 @@ +Jade demo \ No newline at end of file diff --git a/examples/inline/dist/webpack-2/styles.css b/examples/inline/dist/webpack-2/styles.css new file mode 100644 index 0000000..232a2cd --- /dev/null +++ b/examples/inline/dist/webpack-2/styles.css @@ -0,0 +1,3 @@ +body { + background: snow; +} \ No newline at end of file diff --git a/examples/inline/webpack.config.js b/examples/inline/webpack.config.js index 581a2ad..f46ca6a 100755 --- a/examples/inline/webpack.config.js +++ b/examples/inline/webpack.config.js @@ -1,9 +1,11 @@ var HtmlWebpackPlugin = require('../..'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); +var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; + module.exports = { entry: './example.js', output: { - path: __dirname + '/dist', + path: __dirname + '/dist/webpack-' + webpackMajorVersion, publicPath: '', filename: 'bundle.js' }, diff --git a/lib/chunksorter.js b/lib/chunksorter.js index 16a73e1..fc41ae5 100644 --- a/lib/chunksorter.js +++ b/lib/chunksorter.js @@ -82,8 +82,8 @@ module.exports.none = function (chunks) { */ module.exports.auto = module.exports.id; -// In webpack 2 the ids are fliped around. -// Therefore the id sort is broken +// In webpack 2 the ids have been flipped. +// Therefore the id sort doesn't work the same way as it did for webpack 1 // Luckily the dependency sort is working as expected if (require('webpack/package.json').version.split('.')[0] === '2') { module.exports.auto = module.exports.dependency; diff --git a/package.json b/package.json index 856507d..0b69db3 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "scripts": { "prepublish": "npm run test", "pretest": "semistandard", - "recompile": "node examples/rebuild.js", + "build-examples": "node examples/build-examples.js", "test": "jasmine" }, "repository": { diff --git a/spec/ExampleSpec.js b/spec/ExampleSpec.js index 192f540..b40a571 100644 --- a/spec/ExampleSpec.js +++ b/spec/ExampleSpec.js @@ -70,6 +70,10 @@ describe('HtmlWebpackPlugin Examples', function () { runExample('html-loader', done); }); + it('inline example', function (done) { + runExample('inline', done); + }); + it('jade-loader example', function (done) { runExample('jade-loader', done); });