diff --git a/.travis.yml b/.travis.yml
index b4267b3e..0e114d3c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,9 +3,17 @@ node_js:
- stable
- lts/*
- 6.9
+env:
+ - WEBPACK_CORE=4
+ - WEBPACK_CORE=beta
+jobs:
+ exclude:
+ - node_js: 6.9
+ env: WEBPACK_CORE=beta
before_install:
- stty columns 120
install:
- travis_retry npm install --ignore-scripts
+ - travis_retry npm install "webpack@$WEBPACK_CORE" --ignore-scripts
script:
- travis_retry npm test
diff --git a/examples/appcache/dist/webpack-5/0714810ae3fb211173e2964249507195.png b/examples/appcache/dist/webpack-5/0714810ae3fb211173e2964249507195.png
new file mode 100644
index 00000000..d71b3d78
Binary files /dev/null and b/examples/appcache/dist/webpack-5/0714810ae3fb211173e2964249507195.png differ
diff --git a/examples/appcache/dist/webpack-5/bundle.js b/examples/appcache/dist/webpack-5/bundle.js
new file mode 100644
index 00000000..9ae17651
--- /dev/null
+++ b/examples/appcache/dist/webpack-5/bundle.js
@@ -0,0 +1,47 @@
+/******/ (() => { // webpackBootstrap
+/******/ var __webpack_modules__ = ({
+
+/***/ 636:
+/***/ (() => {
+
+// extracted by mini-css-extract-plugin
+
+/***/ })
+
+/******/ });
+/************************************************************************/
+/******/ // The module cache
+/******/ var __webpack_module_cache__ = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/ // Check if module is in cache
+/******/ if(__webpack_module_cache__[moduleId]) {
+/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = __webpack_module_cache__[moduleId] = {
+/******/ // no module.id needed
+/******/ // no module.loaded needed
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/************************************************************************/
+/******/ /************************************************************************/
+(() => {
+__webpack_require__(636);
+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-5/index.html b/examples/appcache/dist/webpack-5/index.html
new file mode 100644
index 00000000..3a2aa9e5
--- /dev/null
+++ b/examples/appcache/dist/webpack-5/index.html
@@ -0,0 +1 @@
+
Example template
\ No newline at end of file
diff --git a/examples/appcache/dist/webpack-5/manifest.appcache b/examples/appcache/dist/webpack-5/manifest.appcache
new file mode 100644
index 00000000..d9dc95c2
--- /dev/null
+++ b/examples/appcache/dist/webpack-5/manifest.appcache
@@ -0,0 +1,9 @@
+CACHE MANIFEST
+# f509954c60c2fd048c91
+
+0714810ae3fb211173e2964249507195.png
+styles.css
+bundle.js
+
+NETWORK:
+*
diff --git a/examples/appcache/dist/webpack-5/styles.css b/examples/appcache/dist/webpack-5/styles.css
new file mode 100644
index 00000000..e86486ba
--- /dev/null
+++ b/examples/appcache/dist/webpack-5/styles.css
@@ -0,0 +1,3 @@
+body {
+ background: snow;
+}
diff --git a/examples/appcache/webpack.config.js b/examples/appcache/webpack.config.js
index 980ebfd5..449a6cf9 100755
--- a/examples/appcache/webpack.config.js
+++ b/examples/appcache/webpack.config.js
@@ -16,7 +16,7 @@ module.exports = {
rules: [
{ test: /\.css$/, use: [MiniCssExtractPlugin.loader, 'css-loader'] },
{ test: /\.png$/, loader: 'file-loader' },
- { test: /\.html$/, loader: 'html-loader?-removeOptionalTags' }
+ { test: /\.html$/, loader: 'html-loader', options: { removeOptionalTags: false } }
]
},
plugins: [
diff --git a/examples/build-examples.js b/examples/build-examples.js
index b1deff37..0e45b0bd 100644
--- a/examples/build-examples.js
+++ b/examples/build-examples.js
@@ -20,7 +20,7 @@ examples.forEach(function (exampleName) {
var configFile = path.join(examplePath, 'webpack.config.js');
var config = require(configFile);
- if (webpackMajorVersion === '4') {
+ if (Number(webpackMajorVersion) >= 4) {
config.plugins.unshift(new webpack.LoaderOptionsPlugin({
options: {
context: process.cwd() // or the same value as `context`
diff --git a/examples/chunk-optimization/dist/webpack-5/73.js b/examples/chunk-optimization/dist/webpack-5/73.js
new file mode 100644
index 00000000..5e01f279
--- /dev/null
+++ b/examples/chunk-optimization/dist/webpack-5/73.js
@@ -0,0 +1,40 @@
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[73],{
+
+/***/ 173:
+/***/ ((module, exports, __webpack_require__) => {
+
+exports = module.exports = __webpack_require__(609)(false);
+// Module
+exports.push([module.id, "body {\n background: snow;\n}", ""]);
+
+
+
+/***/ }),
+
+/***/ 73:
+/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
+
+
+var content = __webpack_require__(173);
+
+if(typeof content === 'string') content = [[module.id, content, '']];
+
+var transform;
+var insertInto;
+
+
+
+var options = {"hmr":true}
+
+options.transform = transform
+options.insertInto = undefined;
+
+var update = __webpack_require__(379)(content, options);
+
+if(content.locals) module.exports = content.locals;
+
+if(false) {}
+
+/***/ })
+
+}]);
\ No newline at end of file
diff --git a/examples/chunk-optimization/dist/webpack-5/805.js b/examples/chunk-optimization/dist/webpack-5/805.js
new file mode 100644
index 00000000..66796e1b
--- /dev/null
+++ b/examples/chunk-optimization/dist/webpack-5/805.js
@@ -0,0 +1,596 @@
+(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[805],{
+
+/***/ 609:
+/***/ ((module) => {
+
+"use strict";
+
+
+/*
+ MIT License http://www.opensource.org/licenses/mit-license.php
+ Author Tobias Koppers @sokra
+*/
+// css base code, injected by the css-loader
+module.exports = function (useSourceMap) {
+ var list = []; // return the list of modules as css string
+
+ list.toString = function toString() {
+ return this.map(function (item) {
+ var content = cssWithMappingToString(item, useSourceMap);
+
+ if (item[2]) {
+ return '@media ' + item[2] + '{' + content + '}';
+ } else {
+ return content;
+ }
+ }).join('');
+ }; // import a list of modules into the list
+
+
+ list.i = function (modules, mediaQuery) {
+ if (typeof modules === 'string') {
+ modules = [[null, modules, '']];
+ }
+
+ var alreadyImportedModules = {};
+
+ for (var i = 0; i < this.length; i++) {
+ var id = this[i][0];
+
+ if (id != null) {
+ alreadyImportedModules[id] = true;
+ }
+ }
+
+ for (i = 0; i < modules.length; i++) {
+ var item = modules[i]; // skip already imported module
+ // this implementation is not 100% perfect for weird media query combinations
+ // when a module is imported multiple times with different media queries.
+ // I hope this will never occur (Hey this way we have smaller bundles)
+
+ if (item[0] == null || !alreadyImportedModules[item[0]]) {
+ if (mediaQuery && !item[2]) {
+ item[2] = mediaQuery;
+ } else if (mediaQuery) {
+ item[2] = '(' + item[2] + ') and (' + mediaQuery + ')';
+ }
+
+ list.push(item);
+ }
+ }
+ };
+
+ return list;
+};
+
+function cssWithMappingToString(item, useSourceMap) {
+ var content = item[1] || '';
+ var cssMapping = item[3];
+
+ if (!cssMapping) {
+ return content;
+ }
+
+ if (useSourceMap && typeof btoa === 'function') {
+ var sourceMapping = toComment(cssMapping);
+ var sourceURLs = cssMapping.sources.map(function (source) {
+ return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */';
+ });
+ return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
+ }
+
+ return [content].join('\n');
+} // Adapted from convert-source-map (MIT)
+
+
+function toComment(sourceMap) {
+ // eslint-disable-next-line no-undef
+ var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
+ var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
+ return '/*# ' + data + ' */';
+}
+
+/***/ }),
+
+/***/ 379:
+/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
+
+/*
+ MIT License http://www.opensource.org/licenses/mit-license.php
+ Author Tobias Koppers @sokra
+*/
+
+var stylesInDom = {};
+
+var memoize = function (fn) {
+ var memo;
+
+ return function () {
+ if (typeof memo === "undefined") memo = fn.apply(this, arguments);
+ return memo;
+ };
+};
+
+var isOldIE = memoize(function () {
+ // Test for IE <= 9 as proposed by Browserhacks
+ // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
+ // Tests for existence of standard globals is to allow style-loader
+ // to operate correctly into non-standard environments
+ // @see https://github.com/webpack-contrib/style-loader/issues/177
+ return window && document && document.all && !window.atob;
+});
+
+var getTarget = function (target, parent) {
+ if (parent){
+ return parent.querySelector(target);
+ }
+ return document.querySelector(target);
+};
+
+var getElement = (function (fn) {
+ var memo = {};
+
+ return function(target, parent) {
+ // If passing function in options, then use it for resolve "head" element.
+ // Useful for Shadow Root style i.e
+ // {
+ // insertInto: function () { return document.querySelector("#foo").shadowRoot }
+ // }
+ if (typeof target === 'function') {
+ return target();
+ }
+ if (typeof memo[target] === "undefined") {
+ var styleTarget = getTarget.call(this, target, parent);
+ // Special case to return head of iframe instead of iframe itself
+ if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
+ try {
+ // This will throw an exception if access to iframe is blocked
+ // due to cross-origin restrictions
+ styleTarget = styleTarget.contentDocument.head;
+ } catch(e) {
+ styleTarget = null;
+ }
+ }
+ memo[target] = styleTarget;
+ }
+ return memo[target]
+ };
+})();
+
+var singleton = null;
+var singletonCounter = 0;
+var stylesInsertedAtTop = [];
+
+var fixUrls = __webpack_require__(657);
+
+module.exports = function(list, options) {
+ if (typeof DEBUG !== "undefined" && DEBUG) {
+ if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
+ }
+
+ options = options || {};
+
+ options.attrs = typeof options.attrs === "object" ? options.attrs : {};
+
+ // Force single-tag solution on IE6-9, which has a hard limit on the # of