diff --git a/.travis.yml b/.travis.yml index 7742397..061af0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,3 +3,7 @@ node_js: - "0.12" - "0.10" - "4" +script: + - npm test + - npm rm webpack && npm i webpack@beta || true + - npm test diff --git a/appveyor.yml b/appveyor.yml index 5bc2d72..47f137c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,4 +20,4 @@ install: test_script: - node --version - npm --version - - npm test \ No newline at end of file + - npm test diff --git a/examples/appcache/dist/0714810ae3fb211173e2964249507195.png b/examples/appcache/dist/webpack-1/0714810ae3fb211173e2964249507195.png similarity index 100% rename from examples/appcache/dist/0714810ae3fb211173e2964249507195.png rename to examples/appcache/dist/webpack-1/0714810ae3fb211173e2964249507195.png diff --git a/examples/appcache/dist/bundle.js b/examples/appcache/dist/webpack-1/bundle.js similarity index 100% rename from examples/appcache/dist/bundle.js rename to examples/appcache/dist/webpack-1/bundle.js diff --git a/examples/appcache/dist/index.html b/examples/appcache/dist/webpack-1/index.html similarity index 100% rename from examples/appcache/dist/index.html rename to examples/appcache/dist/webpack-1/index.html diff --git a/examples/appcache/dist/manifest.appcache b/examples/appcache/dist/webpack-1/manifest.appcache similarity index 100% rename from examples/appcache/dist/manifest.appcache rename to examples/appcache/dist/webpack-1/manifest.appcache diff --git a/examples/appcache/dist/styles.css b/examples/appcache/dist/webpack-1/styles.css similarity index 100% rename from examples/appcache/dist/styles.css rename to examples/appcache/dist/webpack-1/styles.css diff --git a/examples/custom-template/dist/0714810ae3fb211173e2964249507195.png b/examples/appcache/dist/webpack-2/0714810ae3fb211173e2964249507195.png similarity index 100% rename from examples/custom-template/dist/0714810ae3fb211173e2964249507195.png rename to examples/appcache/dist/webpack-2/0714810ae3fb211173e2964249507195.png diff --git a/examples/appcache/dist/webpack-2/bundle.js b/examples/appcache/dist/webpack-2/bundle.js new file mode 100644 index 0000000..5e10a56 --- /dev/null +++ b/examples/appcache/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__) { + + __webpack_require__(0); + var h1 = document.createElement('h1'); + h1.innerHTML = 'Hello world!'; + document.body.appendChild(h1); + + +/***/ } +/******/ ]); \ No newline at end of file diff --git a/examples/appcache/dist/webpack-2/index.html b/examples/appcache/dist/webpack-2/index.html new file mode 100644 index 0000000..3a2aa9e --- /dev/null +++ b/examples/appcache/dist/webpack-2/index.html @@ -0,0 +1 @@ +
\ No newline at end of file
diff --git a/examples/appcache/dist/webpack-2/manifest.appcache b/examples/appcache/dist/webpack-2/manifest.appcache
new file mode 100644
index 0000000..fa216ec
--- /dev/null
+++ b/examples/appcache/dist/webpack-2/manifest.appcache
@@ -0,0 +1,9 @@
+CACHE MANIFEST
+# 4dd687f1b70b04b5bb2e
+
+0714810ae3fb211173e2964249507195.png
+bundle.js
+styles.css
+
+NETWORK:
+*
diff --git a/examples/custom-template/dist/styles.css b/examples/appcache/dist/webpack-2/styles.css
similarity index 100%
rename from examples/custom-template/dist/styles.css
rename to examples/appcache/dist/webpack-2/styles.css
diff --git a/examples/appcache/webpack.config.js b/examples/appcache/webpack.config.js
index 503cc88..2d12791 100755
--- a/examples/appcache/webpack.config.js
+++ b/examples/appcache/webpack.config.js
@@ -1,10 +1,12 @@
var AppCachePlugin = require('appcache-webpack-plugin');
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'
},
@@ -28,4 +30,3 @@ module.exports = {
new ExtractTextPlugin('styles.css')
]
};
-
diff --git a/examples/build-examples.js b/examples/build-examples.js
new file mode 100644
index 0000000..563224c
--- /dev/null
+++ b/examples/build-examples.js
@@ -0,0 +1,24 @@
+/**
+ * This file is just a helper to compile all examples.
+ *
+ * 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');
+var path = require('path');
+var execSync = require('child_process').execSync;
+var rm_rf = require('rimraf');
+var webpackBin = path.resolve(__dirname, '..', 'node_modules', '.bin', 'webpack');
+
+var examples = fs.readdirSync(__dirname).filter(function (file) {
+ return fs.statSync(path.join(__dirname, file)).isDirectory();
+});
+
+examples.forEach(function (exampleName) {
+ var examplePath = path.join(__dirname, exampleName);
+ var configFile = path.join(examplePath, 'webpack.config.js');
+ rm_rf.sync(path.join(examplePath, 'dist', 'webpack-' + webpackMajorVersion));
+ execSync(webpackBin + ' --context "' + examplePath + '" --config "' + configFile + '"');
+});
diff --git a/examples/html-loader/dist/0714810ae3fb211173e2964249507195.png b/examples/custom-template/dist/webpack-1/0714810ae3fb211173e2964249507195.png
similarity index 100%
rename from examples/html-loader/dist/0714810ae3fb211173e2964249507195.png
rename to examples/custom-template/dist/webpack-1/0714810ae3fb211173e2964249507195.png
diff --git a/examples/custom-template/dist/bundle.js b/examples/custom-template/dist/webpack-1/bundle.js
similarity index 100%
rename from examples/custom-template/dist/bundle.js
rename to examples/custom-template/dist/webpack-1/bundle.js
diff --git a/examples/custom-template/dist/index.html b/examples/custom-template/dist/webpack-1/index.html
similarity index 100%
rename from examples/custom-template/dist/index.html
rename to examples/custom-template/dist/webpack-1/index.html
diff --git a/examples/favicon/dist/styles.css b/examples/custom-template/dist/webpack-1/styles.css
similarity index 100%
rename from examples/favicon/dist/styles.css
rename to examples/custom-template/dist/webpack-1/styles.css
diff --git a/examples/jade-loader/dist/0714810ae3fb211173e2964249507195.png b/examples/custom-template/dist/webpack-2/0714810ae3fb211173e2964249507195.png
similarity index 100%
rename from examples/jade-loader/dist/0714810ae3fb211173e2964249507195.png
rename to examples/custom-template/dist/webpack-2/0714810ae3fb211173e2964249507195.png
diff --git a/examples/custom-template/dist/webpack-2/bundle.js b/examples/custom-template/dist/webpack-2/bundle.js
new file mode 100644
index 0000000..5e10a56
--- /dev/null
+++ b/examples/custom-template/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__) {
+
+ __webpack_require__(0);
+ var h1 = document.createElement('h1');
+ h1.innerHTML = 'Hello world!';
+ document.body.appendChild(h1);
+
+
+/***/ }
+/******/ ]);
\ No newline at end of file
diff --git a/examples/custom-template/dist/webpack-2/index.html b/examples/custom-template/dist/webpack-2/index.html
new file mode 100644
index 0000000..a9d8bf4
--- /dev/null
+++ b/examples/custom-template/dist/webpack-2/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/html-loader/dist/styles.css b/examples/custom-template/dist/webpack-2/styles.css
similarity index 100%
rename from examples/html-loader/dist/styles.css
rename to examples/custom-template/dist/webpack-2/styles.css
diff --git a/examples/custom-template/webpack.config.js b/examples/custom-template/webpack.config.js
index 967ddb2..d512d4a 100755
--- a/examples/custom-template/webpack.config.js
+++ b/examples/custom-template/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/examples/default/dist/bundle.js b/examples/default/dist/webpack-1/bundle.js
similarity index 100%
rename from examples/default/dist/bundle.js
rename to examples/default/dist/webpack-1/bundle.js
diff --git a/examples/default/dist/index.html b/examples/default/dist/webpack-1/index.html
similarity index 100%
rename from examples/default/dist/index.html
rename to examples/default/dist/webpack-1/index.html
diff --git a/examples/default/dist/webpack-2/bundle.js b/examples/default/dist/webpack-2/bundle.js
new file mode 100644
index 0000000..df25951
--- /dev/null
+++ b/examples/default/dist/webpack-2/bundle.js
@@ -0,0 +1,404 @@
+/******/ (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, __webpack_require__) {
+
+ // style-loader: Adds some css to the DOM by adding a