diff --git a/src/index.js b/src/index.js
index 5d81e36b..d2a19637 100644
--- a/src/index.js
+++ b/src/index.js
@@ -5,11 +5,6 @@ const path = require("path");
const { validate } = require("schema-utils");
const { SyncWaterfallHook } = require("tapable");
-// @ts-ignore
-const JsonpChunkLoadingRuntimeModule = require("webpack/lib/web/JsonpChunkLoadingRuntimeModule");
-// @ts-ignore
-const compileBooleanMatcher = require("webpack/lib/util/compileBooleanMatcher");
-
const schema = require("./plugin-options.json");
const {
trueFn,
@@ -20,6 +15,7 @@ const {
compareModulesByIdentifier,
getUndoPath,
BASE_URI,
+ compileBooleanMatcher,
} = require("./utils");
/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */
@@ -110,6 +106,8 @@ const CODE_GENERATION_RESULT = {
/**
* @typedef {Object} MiniCssExtractPluginCompilationHooks
* @property {import("tapable").SyncWaterfallHook<[string, VarNames], string>} beforeTagInsert
+ * @property {SyncWaterfallHook<[string, Chunk]>} linkPreload
+ * @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch
*/
/**
@@ -531,7 +529,8 @@ class MiniCssExtractPlugin {
/**
* Returns all hooks for the given compilation
- * @param {Compilation} compilation
+ * @param {Compilation} compilation the compilation
+ * @returns {MiniCssExtractPluginCompilationHooks} hooks
*/
static getCompilationHooks(compilation) {
let hooks = compilationHooksMap.get(compilation);
@@ -542,6 +541,8 @@ class MiniCssExtractPlugin {
["source", "varNames"],
"string"
),
+ linkPreload: new SyncWaterfallHook(["source", "chunk"]),
+ linkPrefetch: new SyncWaterfallHook(["source", "chunk"]),
};
compilationHooksMap.set(compilation, hooks);
}
@@ -854,16 +855,9 @@ class MiniCssExtractPlugin {
function chunkHasCss(chunk, chunkGraph) {
// this function replace:
// const chunkHasCss = require("webpack/lib/css/CssModulesPlugin").chunkHasCss;
- return (
- !!chunkGraph.getChunkModulesIterableBySourceType(chunk, "css") ||
- !!chunkGraph.getChunkModulesIterableBySourceType(
- chunk,
- "css-import"
- ) ||
- !!chunkGraph.getChunkModulesIterableBySourceType(
- chunk,
- "css/mini-extract"
- )
+ return !!chunkGraph.getChunkModulesIterableBySourceType(
+ chunk,
+ "css/mini-extract"
);
}
@@ -883,39 +877,36 @@ class MiniCssExtractPlugin {
const { chunkGraph, chunk, runtimeRequirements } = this;
const {
runtimeTemplate,
- outputOptions: { chunkLoadingGlobal, crossOriginLoading },
+ outputOptions: { crossOriginLoading },
} = /** @type {Compilation} */ (this.compilation);
const chunkMap = getCssChunkObject(
/** @type {Chunk} */ (chunk),
/** @type {Compilation} */ (this.compilation)
);
- const { globalObject } = runtimeTemplate;
- const { linkPreload, linkPrefetch } =
- JsonpChunkLoadingRuntimeModule.getCompilationHooks(compilation);
- const conditionMap = /** @type {ChunkGraph} */ (
- chunkGraph
- ).getChunkConditionMap(/** @type {Chunk} */ (chunk), chunkHasCss);
- const hasCssMatcher = compileBooleanMatcher(conditionMap);
-
const withLoading =
runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers) &&
Object.keys(chunkMap).length > 0;
const withHmr = runtimeRequirements.has(
RuntimeGlobals.hmrDownloadUpdateHandlers
);
+
+ if (!withLoading && !withHmr) {
+ return "";
+ }
+
+ const conditionMap = /** @type {ChunkGraph} */ (
+ chunkGraph
+ ).getChunkConditionMap(/** @type {Chunk} */ (chunk), chunkHasCss);
+ const hasCssMatcher = compileBooleanMatcher(conditionMap);
const withPrefetch = runtimeRequirements.has(
RuntimeGlobals.prefetchChunkHandlers
);
const withPreload = runtimeRequirements.has(
RuntimeGlobals.preloadChunkHandlers
);
- const chunkLoadingGlobalExpr = `${globalObject}[${JSON.stringify(
- chunkLoadingGlobal
- )}]`;
+ const { linkPreload, linkPrefetch } =
+ MiniCssExtractPlugin.getCompilationHooks(compilation);
- if (!withLoading && !withHmr) {
- return "";
- }
return Template.asString([
'if (typeof document === "undefined") return;',
`var createStylesheet = ${runtimeTemplate.basicFunction(
@@ -1052,23 +1043,6 @@ class MiniCssExtractPlugin {
),
"};",
"",
- `var webpackJsonpCallback = ${runtimeTemplate.basicFunction(
- "parentChunkLoadingFunction, data",
- [
- runtimeTemplate.destructureArray(["chunkIds"], "data"),
- "for(var i=0;i < chunkIds.length; i++) {",
- Template.indent([
- "var chunkId = chunkIds[i];",
- "installedCssChunks[chunkId] = 0;",
- ]),
- "}",
- ]
- )}`,
- "",
- `var chunkLoadingGlobal = ${chunkLoadingGlobalExpr} = ${chunkLoadingGlobalExpr} || [];`,
- "chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));",
- "chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));",
- "",
`${
RuntimeGlobals.ensureChunkHandlers
}.miniCss = ${runtimeTemplate.basicFunction(
@@ -1158,55 +1132,27 @@ class MiniCssExtractPlugin {
hasCssMatcher === true ? "true" : hasCssMatcher("chunkId")
}) {`,
Template.indent([
- `var getLinkElements = function (rel, as) {`,
- Template.indent([
- `var links = document.getElementsByTagName("link");`,
- `var loadedLinks = [];`,
- `for (var i = 0; i < links.length; i++) {`,
- Template.indent([
- `if (`,
- Template.indent([
- `links[i].getAttribute("rel") === rel &&`,
- `links[i].getAttribute("as") === as`,
- ]),
- `) {`,
- Template.indent([
- `loadedLinks.push(links[i].getAttribute("href"));`,
- ]),
- `}`,
+ "installedCssChunks[chunkId] = null;",
+ linkPrefetch.call(
+ Template.asString([
+ "var link = document.createElement('link');",
+ crossOriginLoading
+ ? `link.crossOrigin = ${JSON.stringify(
+ crossOriginLoading
+ )};`
+ : "",
+ `if (${RuntimeGlobals.scriptNonce}) {`,
+ Template.indent(
+ `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});`
+ ),
+ "}",
+ 'link.rel = "prefetch";',
+ 'link.as = "style";',
+ `link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.require}.miniCssF(chunkId);`,
]),
- `}`,
- `return loadedLinks;`,
- ]),
- `};`,
- "",
- `var loadedPreloadLinkElements = getLinkElements("preload", "style");`,
- `var chunkIdHref = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.require}.miniCssF(chunkId);`,
- `if(!loadedPreloadLinkElements.includes(chunkIdHref)) {`,
- Template.indent([
- "installedCssChunks[chunkId] = null;",
- linkPrefetch.call(
- Template.asString([
- "var link = document.createElement('link');",
- crossOriginLoading
- ? `link.crossOrigin = ${JSON.stringify(
- crossOriginLoading
- )};`
- : "",
- `if (${RuntimeGlobals.scriptNonce}) {`,
- Template.indent(
- `link.setAttribute("nonce", ${RuntimeGlobals.scriptNonce});`
- ),
- "}",
- 'link.rel = "prefetch";',
- 'link.as = "style";',
- `link.href = ${RuntimeGlobals.publicPath} + ${RuntimeGlobals.require}.miniCssF(chunkId);`,
- ]),
- chunk
- ),
- "document.head.appendChild(link);",
- ]),
- `}`,
+ /** @type {Chunk} */ (chunk)
+ ),
+ "document.head.appendChild(link);",
]),
"}",
])};`
@@ -1249,7 +1195,7 @@ class MiniCssExtractPlugin {
])
: "",
]),
- chunk
+ /** @type {Chunk} */ (chunk)
),
"document.head.appendChild(link);",
]),
diff --git a/src/utils.js b/src/utils.js
index 68ab5f08..fc1c238f 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -214,6 +214,265 @@ function stringifyLocal(value) {
return typeof value === "function" ? value.toString() : JSON.stringify(value);
}
+/**
+ * @param {string} str string
+ * @returns {string} string
+ */
+const toSimpleString = (str) => {
+ if (`${+str}` === str) {
+ return str;
+ }
+ return JSON.stringify(str);
+};
+
+/**
+ * @param {string} str string
+ * @returns {string} quoted meta
+ */
+const quoteMeta = (str) => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
+
+/**
+ * @param {Array} items items
+ * @returns {string} common prefix
+ */
+const getCommonPrefix = (items) => {
+ let prefix = items[0];
+
+ for (let i = 1; i < items.length; i++) {
+ const item = items[i];
+ for (let p = 0; p < prefix.length; p++) {
+ if (item[p] !== prefix[p]) {
+ prefix = prefix.slice(0, p);
+ break;
+ }
+ }
+ }
+
+ return prefix;
+};
+
+/**
+ * @param {Array} items items
+ * @returns {string} common suffix
+ */
+const getCommonSuffix = (items) => {
+ let suffix = items[0];
+
+ for (let i = 1; i < items.length; i++) {
+ const item = items[i];
+ for (let p = item.length - 1, s = suffix.length - 1; s >= 0; p--, s--) {
+ if (item[p] !== suffix[s]) {
+ suffix = suffix.slice(s + 1);
+ break;
+ }
+ }
+ }
+
+ return suffix;
+};
+
+/**
+ * @param {Set} itemsSet items set
+ * @param {(str: string) => string | false} getKey get key function
+ * @param {(str: Array) => boolean} condition condition
+ * @returns {Array>} list of common items
+ */
+const popCommonItems = (itemsSet, getKey, condition) => {
+ /** @type {Map>} */
+ const map = new Map();
+
+ for (const item of itemsSet) {
+ const key = getKey(item);
+ if (key) {
+ let list = map.get(key);
+ if (list === undefined) {
+ /** @type {Array} */
+ list = [];
+ map.set(key, list);
+ }
+ list.push(item);
+ }
+ }
+
+ /** @type {Array>} */
+ const result = [];
+
+ for (const list of map.values()) {
+ if (condition(list)) {
+ for (const item of list) {
+ itemsSet.delete(item);
+ }
+ result.push(list);
+ }
+ }
+
+ return result;
+};
+
+/**
+ * @param {Array} itemsArr array of items
+ * @returns {string} regexp
+ */
+const itemsToRegexp = (itemsArr) => {
+ if (itemsArr.length === 1) {
+ return quoteMeta(itemsArr[0]);
+ }
+
+ /** @type {Array} */
+ const finishedItems = [];
+
+ // merge single char items: (a|b|c|d|ef) => ([abcd]|ef)
+ let countOfSingleCharItems = 0;
+
+ for (const item of itemsArr) {
+ if (item.length === 1) {
+ // eslint-disable-next-line no-plusplus
+ countOfSingleCharItems++;
+ }
+ }
+
+ // special case for only single char items
+ if (countOfSingleCharItems === itemsArr.length) {
+ return `[${quoteMeta(itemsArr.sort().join(""))}]`;
+ }
+
+ const items = new Set(itemsArr.sort());
+
+ if (countOfSingleCharItems > 2) {
+ let singleCharItems = "";
+ for (const item of items) {
+ if (item.length === 1) {
+ singleCharItems += item;
+ items.delete(item);
+ }
+ }
+ finishedItems.push(`[${quoteMeta(singleCharItems)}]`);
+ }
+
+ // special case for 2 items with common prefix/suffix
+ if (finishedItems.length === 0 && items.size === 2) {
+ const prefix = getCommonPrefix(itemsArr);
+ const suffix = getCommonSuffix(
+ itemsArr.map((item) => item.slice(prefix.length))
+ );
+
+ if (prefix.length > 0 || suffix.length > 0) {
+ return `${quoteMeta(prefix)}${itemsToRegexp(
+ itemsArr.map((i) => i.slice(prefix.length, -suffix.length || undefined))
+ )}${quoteMeta(suffix)}`;
+ }
+ }
+
+ // special case for 2 items with common suffix
+ if (finishedItems.length === 0 && items.size === 2) {
+ /** @type {Iterator} */
+ const it = items[Symbol.iterator]();
+ const a = it.next().value;
+ const b = it.next().value;
+ if (a.length > 0 && b.length > 0 && a.slice(-1) === b.slice(-1)) {
+ return `${itemsToRegexp([a.slice(0, -1), b.slice(0, -1)])}${quoteMeta(
+ a.slice(-1)
+ )}`;
+ }
+ }
+
+ // find common prefix: (a1|a2|a3|a4|b5) => (a(1|2|3|4)|b5)
+ const prefixed = popCommonItems(
+ items,
+ (item) => (item.length >= 1 ? item[0] : false),
+ (list) => {
+ if (list.length >= 3) return true;
+ if (list.length <= 1) return false;
+ return list[0][1] === list[1][1];
+ }
+ );
+ for (const prefixedItems of prefixed) {
+ const prefix = getCommonPrefix(prefixedItems);
+ finishedItems.push(
+ `${quoteMeta(prefix)}${itemsToRegexp(
+ prefixedItems.map((i) => i.slice(prefix.length))
+ )}`
+ );
+ }
+
+ // find common suffix: (a1|b1|c1|d1|e2) => ((a|b|c|d)1|e2)
+ const suffixed = popCommonItems(
+ items,
+ (item) => (item.length >= 1 ? item.slice(-1) : false),
+ (list) => {
+ if (list.length >= 3) return true;
+ if (list.length <= 1) return false;
+ return list[0].slice(-2) === list[1].slice(-2);
+ }
+ );
+ for (const suffixedItems of suffixed) {
+ const suffix = getCommonSuffix(suffixedItems);
+ finishedItems.push(
+ `${itemsToRegexp(
+ suffixedItems.map((i) => i.slice(0, -suffix.length))
+ )}${quoteMeta(suffix)}`
+ );
+ }
+
+ // TODO further optimize regexp, i. e.
+ // use ranges: (1|2|3|4|a) => [1-4a]
+ const conditional = finishedItems.concat(Array.from(items, quoteMeta));
+ if (conditional.length === 1) return conditional[0];
+ return `(${conditional.join("|")})`;
+};
+
+/**
+ * @param {string[]} positiveItems positive items
+ * @param {string[]} negativeItems negative items
+ * @returns {function(string): string} a template function to determine the value at runtime
+ */
+const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => {
+ if (positiveItems.length === 0) {
+ return () => "false";
+ }
+
+ if (negativeItems.length === 0) {
+ return () => "true";
+ }
+
+ if (positiveItems.length === 1) {
+ return (value) => `${toSimpleString(positiveItems[0])} == ${value}`;
+ }
+
+ if (negativeItems.length === 1) {
+ return (value) => `${toSimpleString(negativeItems[0])} != ${value}`;
+ }
+
+ const positiveRegexp = itemsToRegexp(positiveItems);
+ const negativeRegexp = itemsToRegexp(negativeItems);
+
+ if (positiveRegexp.length <= negativeRegexp.length) {
+ return (value) => `/^${positiveRegexp}$/.test(${value})`;
+ }
+
+ return (value) => `!/^${negativeRegexp}$/.test(${value})`;
+};
+
+// TODO simplify in the next major release and use it from webpack
+/**
+ * @param {Record} map value map
+ * @returns {boolean|(function(string): string)} true/false, when unconditionally true/false, or a template function to determine the value at runtime
+ */
+const compileBooleanMatcher = (map) => {
+ const positiveItems = Object.keys(map).filter((i) => map[i]);
+ const negativeItems = Object.keys(map).filter((i) => !map[i]);
+
+ if (positiveItems.length === 0) {
+ return false;
+ }
+
+ if (negativeItems.length === 0) {
+ return true;
+ }
+
+ return compileBooleanMatcherFromLists(positiveItems, negativeItems);
+};
+
module.exports = {
trueFn,
findModuleById,
@@ -227,4 +486,5 @@ module.exports = {
stringifyRequest,
stringifyLocal,
getUndoPath,
+ compileBooleanMatcher,
};
diff --git a/test/cases/chunkFilename-fullhash/expected/webpack-5-importModule/0.bb74e774207d1a909943.css b/test/cases/chunkFilename-fullhash/expected/webpack-5-importModule/0.ec6b19ad9e5afccf41ed.css
similarity index 100%
rename from test/cases/chunkFilename-fullhash/expected/webpack-5-importModule/0.bb74e774207d1a909943.css
rename to test/cases/chunkFilename-fullhash/expected/webpack-5-importModule/0.ec6b19ad9e5afccf41ed.css
diff --git a/test/cases/chunkFilename-fullhash/expected/webpack-5-importModule/bb74e774207d1a909943.css b/test/cases/chunkFilename-fullhash/expected/webpack-5-importModule/ec6b19ad9e5afccf41ed.css
similarity index 100%
rename from test/cases/chunkFilename-fullhash/expected/webpack-5-importModule/bb74e774207d1a909943.css
rename to test/cases/chunkFilename-fullhash/expected/webpack-5-importModule/ec6b19ad9e5afccf41ed.css
diff --git a/test/cases/chunkFilename-fullhash/expected/webpack-5-importModule/main.js b/test/cases/chunkFilename-fullhash/expected/webpack-5-importModule/main.js
index e288a56b..699df42d 100644
--- a/test/cases/chunkFilename-fullhash/expected/webpack-5-importModule/main.js
+++ b/test/cases/chunkFilename-fullhash/expected/webpack-5-importModule/main.js
@@ -73,7 +73,7 @@ __webpack_require__.r(__webpack_exports__);
/******/
/******/ /* webpack/runtime/getFullHash */
/******/ (() => {
-/******/ __webpack_require__.h = () => ("bb74e774207d1a909943")
+/******/ __webpack_require__.h = () => ("ec6b19ad9e5afccf41ed")
/******/ })();
/******/
/******/ /* webpack/runtime/global */
@@ -253,6 +253,10 @@ __webpack_require__.r(__webpack_exports__);
/******/ };
/******/
/******/ // no hmr
+/******/
+/******/ // no prefetching
+/******/
+/******/ // no preloaded
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
diff --git a/test/cases/hmr/expected/main.js b/test/cases/hmr/expected/main.js
index 39fc3d64..ff182fd7 100644
--- a/test/cases/hmr/expected/main.js
+++ b/test/cases/hmr/expected/main.js
@@ -1029,6 +1029,10 @@ __webpack_require__.r(__webpack_exports__);
/******/ }));
/******/ });
/******/ }
+/******/
+/******/ // no prefetching
+/******/
+/******/ // no preloaded
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
diff --git a/test/cases/insert-function/expected/main.js b/test/cases/insert-function/expected/main.js
index 0f7f4ea5..bb3fbf19 100644
--- a/test/cases/insert-function/expected/main.js
+++ b/test/cases/insert-function/expected/main.js
@@ -238,6 +238,10 @@
/******/ };
/******/
/******/ // no hmr
+/******/
+/******/ // no prefetching
+/******/
+/******/ // no preloaded
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
diff --git a/test/cases/insert-string/expected/main.js b/test/cases/insert-string/expected/main.js
index faf5ef4c..d2550a28 100644
--- a/test/cases/insert-string/expected/main.js
+++ b/test/cases/insert-string/expected/main.js
@@ -234,6 +234,10 @@
/******/ };
/******/
/******/ // no hmr
+/******/
+/******/ // no prefetching
+/******/
+/******/ // no preloaded
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
diff --git a/test/cases/insert-undefined/expected/main.js b/test/cases/insert-undefined/expected/main.js
index eef6572b..ae8118ca 100644
--- a/test/cases/insert-undefined/expected/main.js
+++ b/test/cases/insert-undefined/expected/main.js
@@ -237,6 +237,10 @@
/******/ };
/******/
/******/ // no hmr
+/******/
+/******/ // no prefetching
+/******/
+/******/ // no preloaded
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
diff --git a/test/cases/prefetch-preload-mixed/a.js b/test/cases/prefetch-preload-mixed/a.js
deleted file mode 100644
index 55e53491..00000000
--- a/test/cases/prefetch-preload-mixed/a.js
+++ /dev/null
@@ -1,2 +0,0 @@
-import(/* webpackPrefetch: true, webpackChunkName: "a1" */ "./a1");
-import(/* webpackPrefetch: true, webpackChunkName: "a2" */ "./a2");
diff --git a/test/cases/prefetch-preload-mixed/a1.js b/test/cases/prefetch-preload-mixed/a1.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/prefetch-preload-mixed/a2.js b/test/cases/prefetch-preload-mixed/a2.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/prefetch-preload-mixed/b1.js b/test/cases/prefetch-preload-mixed/b1.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/prefetch-preload-mixed/b2.js b/test/cases/prefetch-preload-mixed/b2.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/prefetch-preload-mixed/c.js b/test/cases/prefetch-preload-mixed/c.js
deleted file mode 100644
index 33838a29..00000000
--- a/test/cases/prefetch-preload-mixed/c.js
+++ /dev/null
@@ -1,2 +0,0 @@
-import(/* webpackPreload: true, webpackChunkName: "c1" */ "./c1");
-import(/* webpackPreload: true, webpackChunkName: "c2" */ "./c2");
diff --git a/test/cases/prefetch-preload-mixed/c1.js b/test/cases/prefetch-preload-mixed/c1.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/prefetch-preload-mixed/c2.js b/test/cases/prefetch-preload-mixed/c2.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/prefetch-preload-mixed/expected/a.js b/test/cases/prefetch-preload-mixed/expected/a.js
deleted file mode 100644
index 4a566fe5..00000000
--- a/test/cases/prefetch-preload-mixed/expected/a.js
+++ /dev/null
@@ -1,11 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[0],[
-/* 0 */,
-/* 1 */
-/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
-
-__webpack_require__.e(/* import() | a1 */ 1).then(__webpack_require__.t.bind(__webpack_require__, 4, 23));
-__webpack_require__.e(/* import() | a2 */ 2).then(__webpack_require__.t.bind(__webpack_require__, 5, 23));
-
-
-/***/ })
-]]);
\ No newline at end of file
diff --git a/test/cases/prefetch-preload-mixed/expected/a1.js b/test/cases/prefetch-preload-mixed/expected/a1.js
deleted file mode 100644
index 3d384b68..00000000
--- a/test/cases/prefetch-preload-mixed/expected/a1.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[1],{
-
-/***/ 4:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch-preload-mixed/expected/a2.js b/test/cases/prefetch-preload-mixed/expected/a2.js
deleted file mode 100644
index ed050c04..00000000
--- a/test/cases/prefetch-preload-mixed/expected/a2.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[2],{
-
-/***/ 5:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch-preload-mixed/expected/b.js b/test/cases/prefetch-preload-mixed/expected/b.js
deleted file mode 100644
index e4268efb..00000000
--- a/test/cases/prefetch-preload-mixed/expected/b.js
+++ /dev/null
@@ -1,13 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[3],{
-
-/***/ 2:
-/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
-
-__webpack_require__.e(/* import() | b1 */ 4).then(__webpack_require__.t.bind(__webpack_require__, 6, 23));
-__webpack_require__.e(/* import() | b2 */ 5).then(__webpack_require__.t.bind(__webpack_require__, 7, 23));
-__webpack_require__.e(/* import() | b3 */ 6).then(__webpack_require__.t.bind(__webpack_require__, 8, 23));
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch-preload-mixed/expected/b1.js b/test/cases/prefetch-preload-mixed/expected/b1.js
deleted file mode 100644
index b21b7aba..00000000
--- a/test/cases/prefetch-preload-mixed/expected/b1.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[4],{
-
-/***/ 6:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch-preload-mixed/expected/b2.js b/test/cases/prefetch-preload-mixed/expected/b2.js
deleted file mode 100644
index 1837f395..00000000
--- a/test/cases/prefetch-preload-mixed/expected/b2.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[5],{
-
-/***/ 7:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch-preload-mixed/expected/b3.js b/test/cases/prefetch-preload-mixed/expected/b3.js
deleted file mode 100644
index af88c7bc..00000000
--- a/test/cases/prefetch-preload-mixed/expected/b3.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[6],{
-
-/***/ 8:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch-preload-mixed/expected/c.js b/test/cases/prefetch-preload-mixed/expected/c.js
deleted file mode 100644
index d64a9865..00000000
--- a/test/cases/prefetch-preload-mixed/expected/c.js
+++ /dev/null
@@ -1,12 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[7],{
-
-/***/ 3:
-/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
-
-__webpack_require__.e(/* import() | c1 */ 8).then(__webpack_require__.t.bind(__webpack_require__, 9, 23));
-__webpack_require__.e(/* import() | c2 */ 9).then(__webpack_require__.t.bind(__webpack_require__, 10, 23));
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch-preload-mixed/expected/c1.js b/test/cases/prefetch-preload-mixed/expected/c1.js
deleted file mode 100644
index 7d4179c9..00000000
--- a/test/cases/prefetch-preload-mixed/expected/c1.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[8],{
-
-/***/ 9:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch-preload-mixed/expected/c2.js b/test/cases/prefetch-preload-mixed/expected/c2.js
deleted file mode 100644
index 5d880e16..00000000
--- a/test/cases/prefetch-preload-mixed/expected/c2.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[9],{
-
-/***/ 10:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch-preload/a.css b/test/cases/prefetch-preload/a.css
new file mode 100644
index 00000000..5451a331
--- /dev/null
+++ b/test/cases/prefetch-preload/a.css
@@ -0,0 +1,3 @@
+.a {
+ color: red;
+}
diff --git a/test/cases/prefetch-preload-mixed/b.js b/test/cases/prefetch-preload/b.js
similarity index 62%
rename from test/cases/prefetch-preload-mixed/b.js
rename to test/cases/prefetch-preload/b.js
index 756debf2..68eec89d 100644
--- a/test/cases/prefetch-preload-mixed/b.js
+++ b/test/cases/prefetch-preload/b.js
@@ -1,3 +1,3 @@
-import(/* webpackPrefetch: true, webpackChunkName: "b1" */ "./b1");
-import(/* webpackPreload: true, webpackChunkName: "b2" */ "./b2");
+import(/* webpackPrefetch: true, webpackChunkName: "b1" */ "./b1.css");
+import(/* webpackPreload: true, webpackChunkName: "b2" */ "./b2.css");
import(/* webpackPrefetch: true, webpackChunkName: "b3" */ "./b3");
diff --git a/test/cases/prefetch-preload/b1.css b/test/cases/prefetch-preload/b1.css
new file mode 100644
index 00000000..effc583c
--- /dev/null
+++ b/test/cases/prefetch-preload/b1.css
@@ -0,0 +1,3 @@
+.b1 {
+ color: red;
+}
diff --git a/test/cases/prefetch-preload/b2.css b/test/cases/prefetch-preload/b2.css
new file mode 100644
index 00000000..e0331e1a
--- /dev/null
+++ b/test/cases/prefetch-preload/b2.css
@@ -0,0 +1,3 @@
+.b2 {
+ color: red;
+}
diff --git a/test/cases/prefetch-preload-mixed/b3.js b/test/cases/prefetch-preload/b3.js
similarity index 100%
rename from test/cases/prefetch-preload-mixed/b3.js
rename to test/cases/prefetch-preload/b3.js
diff --git a/test/cases/prefetch-preload/c.js b/test/cases/prefetch-preload/c.js
new file mode 100644
index 00000000..ce96cadc
--- /dev/null
+++ b/test/cases/prefetch-preload/c.js
@@ -0,0 +1,2 @@
+import(/* webpackPreload: true, webpackChunkName: "c1" */ "./c1.css");
+import(/* webpackPreload: true, webpackChunkName: "c2" */ "./c2.css");
diff --git a/test/cases/prefetch-preload/c1.css b/test/cases/prefetch-preload/c1.css
new file mode 100644
index 00000000..8725bcb0
--- /dev/null
+++ b/test/cases/prefetch-preload/c1.css
@@ -0,0 +1,3 @@
+.c1 {
+ color: red;
+}
diff --git a/test/cases/prefetch-preload/c2.css b/test/cases/prefetch-preload/c2.css
new file mode 100644
index 00000000..a124f6df
--- /dev/null
+++ b/test/cases/prefetch-preload/c2.css
@@ -0,0 +1,3 @@
+.c2 {
+ color: red;
+}
diff --git a/test/cases/prefetch-preload/expected/a.css b/test/cases/prefetch-preload/expected/a.css
new file mode 100644
index 00000000..98f445d8
--- /dev/null
+++ b/test/cases/prefetch-preload/expected/a.css
@@ -0,0 +1,4 @@
+.a {
+ color: red;
+}
+
diff --git a/test/cases/prefetch-preload/expected/b.js b/test/cases/prefetch-preload/expected/b.js
new file mode 100644
index 00000000..7b97d9e9
--- /dev/null
+++ b/test/cases/prefetch-preload/expected/b.js
@@ -0,0 +1,13 @@
+(self["webpackChunk"] = self["webpackChunk"] || []).push([[1],{
+
+/***/ 2:
+/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
+
+__webpack_require__.e(/* import() | b1 */ 2).then(__webpack_require__.bind(__webpack_require__, 4));
+__webpack_require__.e(/* import() | b2 */ 3).then(__webpack_require__.bind(__webpack_require__, 5));
+__webpack_require__.e(/* import() | b3 */ 4).then(__webpack_require__.t.bind(__webpack_require__, 6, 23));
+
+
+/***/ })
+
+}]);
\ No newline at end of file
diff --git a/test/cases/prefetch-preload/expected/b1.css b/test/cases/prefetch-preload/expected/b1.css
new file mode 100644
index 00000000..4ba3041c
--- /dev/null
+++ b/test/cases/prefetch-preload/expected/b1.css
@@ -0,0 +1,4 @@
+.b1 {
+ color: red;
+}
+
diff --git a/test/cases/prefetch-preload/expected/b2.css b/test/cases/prefetch-preload/expected/b2.css
new file mode 100644
index 00000000..3bc21aa1
--- /dev/null
+++ b/test/cases/prefetch-preload/expected/b2.css
@@ -0,0 +1,4 @@
+.b2 {
+ color: red;
+}
+
diff --git a/test/cases/prefetch-preload/expected/c.js b/test/cases/prefetch-preload/expected/c.js
new file mode 100644
index 00000000..45d60ccc
--- /dev/null
+++ b/test/cases/prefetch-preload/expected/c.js
@@ -0,0 +1,12 @@
+(self["webpackChunk"] = self["webpackChunk"] || []).push([[5],{
+
+/***/ 3:
+/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
+
+__webpack_require__.e(/* import() | c1 */ 6).then(__webpack_require__.bind(__webpack_require__, 7));
+__webpack_require__.e(/* import() | c2 */ 7).then(__webpack_require__.bind(__webpack_require__, 8));
+
+
+/***/ })
+
+}]);
\ No newline at end of file
diff --git a/test/cases/prefetch-preload/expected/c1.css b/test/cases/prefetch-preload/expected/c1.css
new file mode 100644
index 00000000..b10e79dd
--- /dev/null
+++ b/test/cases/prefetch-preload/expected/c1.css
@@ -0,0 +1,4 @@
+.c1 {
+ color: red;
+}
+
diff --git a/test/cases/prefetch-preload/expected/c2.css b/test/cases/prefetch-preload/expected/c2.css
new file mode 100644
index 00000000..a17ea975
--- /dev/null
+++ b/test/cases/prefetch-preload/expected/c2.css
@@ -0,0 +1,4 @@
+.c2 {
+ color: red;
+}
+
diff --git a/test/cases/prefetch-preload-mixed/expected/main.js b/test/cases/prefetch-preload/expected/main.js
similarity index 75%
rename from test/cases/prefetch-preload-mixed/expected/main.js
rename to test/cases/prefetch-preload/expected/main.js
index 9a0c0f74..7fc8edd5 100644
--- a/test/cases/prefetch-preload-mixed/expected/main.js
+++ b/test/cases/prefetch-preload/expected/main.js
@@ -141,7 +141,7 @@
/******/ // This function allow to reference async chunks
/******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template
-/******/ return "" + {"0":"a","1":"a1","2":"a2","3":"b","4":"b1","5":"b2","6":"b3","7":"c","8":"c1","9":"c2"}[chunkId] + ".js";
+/******/ return "" + {"0":"a","1":"b","2":"b1","3":"b2","4":"b3","5":"c","6":"c1","7":"c2"}[chunkId] + ".js";
/******/ };
/******/ })();
/******/
@@ -150,7 +150,7 @@
/******/ // This function allow to reference async chunks
/******/ __webpack_require__.miniCssF = (chunkId) => {
/******/ // return url for filenames based on template
-/******/ return undefined;
+/******/ return "" + {"0":"a","2":"b1","3":"b2","6":"c1","7":"c2"}[chunkId] + ".css";
/******/ };
/******/ })();
/******/
@@ -251,6 +251,118 @@
/******/ __webpack_require__.p = scriptUrl;
/******/ })();
/******/
+/******/ /* webpack/runtime/css loading */
+/******/ (() => {
+/******/ if (typeof document === "undefined") return;
+/******/ var createStylesheet = (chunkId, fullhref, oldTag, resolve, reject) => {
+/******/ var linkTag = document.createElement("link");
+/******/
+/******/ linkTag.rel = "stylesheet";
+/******/ linkTag.type = "text/css";
+/******/ if (__webpack_require__.nc) {
+/******/ linkTag.nonce = __webpack_require__.nc;
+/******/ }
+/******/ var onLinkComplete = (event) => {
+/******/ // avoid mem leaks.
+/******/ linkTag.onerror = linkTag.onload = null;
+/******/ if (event.type === 'load') {
+/******/ resolve();
+/******/ } else {
+/******/ var errorType = event && event.type;
+/******/ var realHref = event && event.target && event.target.href || fullhref;
+/******/ var err = new Error("Loading CSS chunk " + chunkId + " failed.\n(" + errorType + ": " + realHref + ")");
+/******/ err.name = "ChunkLoadError";
+/******/ err.code = "CSS_CHUNK_LOAD_FAILED";
+/******/ err.type = errorType;
+/******/ err.request = realHref;
+/******/ if (linkTag.parentNode) linkTag.parentNode.removeChild(linkTag)
+/******/ reject(err);
+/******/ }
+/******/ }
+/******/ linkTag.onerror = linkTag.onload = onLinkComplete;
+/******/ linkTag.href = fullhref;
+/******/
+/******/
+/******/ if (oldTag) {
+/******/ oldTag.parentNode.insertBefore(linkTag, oldTag.nextSibling);
+/******/ } else {
+/******/ document.head.appendChild(linkTag);
+/******/ }
+/******/ return linkTag;
+/******/ };
+/******/ var findStylesheet = (href, fullhref) => {
+/******/ var existingLinkTags = document.getElementsByTagName("link");
+/******/ for(var i = 0; i < existingLinkTags.length; i++) {
+/******/ var tag = existingLinkTags[i];
+/******/ var dataHref = tag.getAttribute("data-href") || tag.getAttribute("href");
+/******/ if(tag.rel === "stylesheet" && (dataHref === href || dataHref === fullhref)) return tag;
+/******/ }
+/******/ var existingStyleTags = document.getElementsByTagName("style");
+/******/ for(var i = 0; i < existingStyleTags.length; i++) {
+/******/ var tag = existingStyleTags[i];
+/******/ var dataHref = tag.getAttribute("data-href");
+/******/ if(dataHref === href || dataHref === fullhref) return tag;
+/******/ }
+/******/ };
+/******/ var loadStylesheet = (chunkId) => {
+/******/ return new Promise((resolve, reject) => {
+/******/ var href = __webpack_require__.miniCssF(chunkId);
+/******/ var fullhref = __webpack_require__.p + href;
+/******/ if(findStylesheet(href, fullhref)) return resolve();
+/******/ createStylesheet(chunkId, fullhref, null, resolve, reject);
+/******/ });
+/******/ }
+/******/ // object to store loaded CSS chunks
+/******/ var installedCssChunks = {
+/******/ 8: 0
+/******/ };
+/******/
+/******/ __webpack_require__.f.miniCss = (chunkId, promises) => {
+/******/ var cssChunks = {"0":1,"2":1,"3":1,"6":1,"7":1};
+/******/ if(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]);
+/******/ else if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) {
+/******/ promises.push(installedCssChunks[chunkId] = loadStylesheet(chunkId).then(() => {
+/******/ installedCssChunks[chunkId] = 0;
+/******/ }, (e) => {
+/******/ delete installedCssChunks[chunkId];
+/******/ throw e;
+/******/ }));
+/******/ }
+/******/ };
+/******/
+/******/ // no hmr
+/******/
+/******/ __webpack_require__.F.miniCss = (chunkId) => {
+/******/ if((!__webpack_require__.o(installedCssChunks, chunkId) || installedCssChunks[chunkId] === undefined) && !/^[1458]$/.test(chunkId)) {
+/******/ installedCssChunks[chunkId] = null;
+/******/ var link = document.createElement('link');
+/******/
+/******/ if (__webpack_require__.nc) {
+/******/ link.setAttribute("nonce", __webpack_require__.nc);
+/******/ }
+/******/ link.rel = "prefetch";
+/******/ link.as = "style";
+/******/ link.href = __webpack_require__.p + __webpack_require__.miniCssF(chunkId);
+/******/ document.head.appendChild(link);
+/******/ }
+/******/ };
+/******/
+/******/ __webpack_require__.H.miniCss = (chunkId) => {
+/******/ if((!__webpack_require__.o(installedCssChunks, chunkId) || installedCssChunks[chunkId] === undefined) && !/^[1458]$/.test(chunkId)) {
+/******/ installedCssChunks[chunkId] = null;
+/******/ var link = document.createElement('link');
+/******/ link.charset = 'utf-8';
+/******/ if (__webpack_require__.nc) {
+/******/ link.setAttribute("nonce", __webpack_require__.nc);
+/******/ }
+/******/ link.rel = "preload";
+/******/ link.as = "style";
+/******/ link.href = __webpack_require__.p + __webpack_require__.miniCssF(chunkId);
+/******/ document.head.appendChild(link);
+/******/ }
+/******/ };
+/******/ })();
+/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ // no baseURI
@@ -259,7 +371,7 @@
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
-/******/ 10: 0
+/******/ 8: 0
/******/ };
/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
@@ -371,13 +483,9 @@
/******/ /* webpack/runtime/chunk prefetch trigger */
/******/ (() => {
/******/ var chunkToChildrenMap = {
-/******/ "0": [
-/******/ 1,
-/******/ 2
-/******/ ],
-/******/ "3": [
-/******/ 4,
-/******/ 6
+/******/ "1": [
+/******/ 2,
+/******/ 4
/******/ ]
/******/ };
/******/ __webpack_require__.f.prefetch = (chunkId, promises) => (Promise.all(promises).then(() => {
@@ -389,12 +497,12 @@
/******/ /* webpack/runtime/chunk preload trigger */
/******/ (() => {
/******/ var chunkToChildrenMap = {
-/******/ "3": [
-/******/ 5
+/******/ "1": [
+/******/ 3
/******/ ],
-/******/ "7": [
-/******/ 8,
-/******/ 9
+/******/ "5": [
+/******/ 6,
+/******/ 7
/******/ ]
/******/ };
/******/ __webpack_require__.f.preload = (chunkId) => {
@@ -405,16 +513,16 @@
/******/
/******/ /* webpack/runtime/startup prefetch */
/******/ (() => {
-/******/ __webpack_require__.O(0, [10], () => {
-/******/ [0,3,7].map(__webpack_require__.E);
+/******/ __webpack_require__.O(0, [8], () => {
+/******/ [0,1,5].map(__webpack_require__.E);
/******/ }, 5);
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
-__webpack_require__.e(/* import() | a */ 0).then(__webpack_require__.t.bind(__webpack_require__, 1, 23));
-__webpack_require__.e(/* import() | b */ 3).then(__webpack_require__.t.bind(__webpack_require__, 2, 23));
-__webpack_require__.e(/* import() | c */ 7).then(__webpack_require__.t.bind(__webpack_require__, 3, 23));
+__webpack_require__.e(/* import() | a */ 0).then(__webpack_require__.bind(__webpack_require__, 1));
+__webpack_require__.e(/* import() | b */ 1).then(__webpack_require__.t.bind(__webpack_require__, 2, 23));
+__webpack_require__.e(/* import() | c */ 5).then(__webpack_require__.t.bind(__webpack_require__, 3, 23));
__webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/ })()
diff --git a/test/cases/prefetch-preload-mixed/index.js b/test/cases/prefetch-preload/index.js
similarity index 65%
rename from test/cases/prefetch-preload-mixed/index.js
rename to test/cases/prefetch-preload/index.js
index f25d6fea..e1c87500 100644
--- a/test/cases/prefetch-preload-mixed/index.js
+++ b/test/cases/prefetch-preload/index.js
@@ -1,3 +1,3 @@
-import(/* webpackPrefetch: true, webpackChunkName: "a" */ "./a");
+import(/* webpackPrefetch: true, webpackChunkName: "a" */ "./a.css");
import(/* webpackPrefetch: true, webpackChunkName: "b" */ "./b");
import(/* webpackPrefetch: true, webpackChunkName: "c" */ "./c");
diff --git a/test/cases/prefetch-preload-mixed/webpack.config.js b/test/cases/prefetch-preload/webpack.config.js
similarity index 100%
rename from test/cases/prefetch-preload-mixed/webpack.config.js
rename to test/cases/prefetch-preload/webpack.config.js
diff --git a/test/cases/prefetch/expected/inner.js b/test/cases/prefetch/expected/inner.js
deleted file mode 100644
index 49ef065a..00000000
--- a/test/cases/prefetch/expected/inner.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[0],{
-
-/***/ 6:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch/expected/inner2.js b/test/cases/prefetch/expected/inner2.js
deleted file mode 100644
index 9eff91f7..00000000
--- a/test/cases/prefetch/expected/inner2.js
+++ /dev/null
@@ -1,17 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[1],{
-
-/***/ 7:
-/***/ (() => {
-
-
-
-/***/ }),
-
-/***/ 8:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch/expected/main.js b/test/cases/prefetch/expected/main.js
deleted file mode 100644
index 6541c8c3..00000000
--- a/test/cases/prefetch/expected/main.js
+++ /dev/null
@@ -1,411 +0,0 @@
-/******/ (() => { // webpackBootstrap
-/******/ var __webpack_modules__ = ([
-/* 0 */,
-/* 1 */
-/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
-
-__webpack_require__.e(/* import() | prefetched2 */ 5).then(__webpack_require__.t.bind(__webpack_require__, 4, 23));
-__webpack_require__.e(/* import() | prefetched2 */ 5).then(__webpack_require__.t.bind(__webpack_require__, 4, 23));
-__webpack_require__.e(/* import() | prefetched3 */ 6).then(__webpack_require__.t.bind(__webpack_require__, 5, 23));
-
-
-/***/ })
-/******/ ]);
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.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;
-/******/ }
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = __webpack_modules__;
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/chunk loaded */
-/******/ (() => {
-/******/ var deferred = [];
-/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
-/******/ if(chunkIds) {
-/******/ priority = priority || 0;
-/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
-/******/ deferred[i] = [chunkIds, fn, priority];
-/******/ return;
-/******/ }
-/******/ var notFulfilled = Infinity;
-/******/ for (var i = 0; i < deferred.length; i++) {
-/******/ var [chunkIds, fn, priority] = deferred[i];
-/******/ var fulfilled = true;
-/******/ for (var j = 0; j < chunkIds.length; j++) {
-/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
-/******/ chunkIds.splice(j--, 1);
-/******/ } else {
-/******/ fulfilled = false;
-/******/ if(priority < notFulfilled) notFulfilled = priority;
-/******/ }
-/******/ }
-/******/ if(fulfilled) {
-/******/ deferred.splice(i--, 1)
-/******/ var r = fn();
-/******/ if (r !== undefined) result = r;
-/******/ }
-/******/ }
-/******/ return result;
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/chunk prefetch function */
-/******/ (() => {
-/******/ __webpack_require__.F = {};
-/******/ __webpack_require__.E = (chunkId) => {
-/******/ Object.keys(__webpack_require__.F).map((key) => {
-/******/ __webpack_require__.F[key](chunkId);
-/******/ });
-/******/ }
-/******/ })();
-/******/
-/******/ /* webpack/runtime/compat get default export */
-/******/ (() => {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = (module) => {
-/******/ var getter = module && module.__esModule ?
-/******/ () => (module['default']) :
-/******/ () => (module);
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/create fake namespace object */
-/******/ (() => {
-/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
-/******/ var leafPrototypes;
-/******/ // create a fake namespace object
-/******/ // mode & 1: value is a module id, require it
-/******/ // mode & 2: merge all properties of value into the ns
-/******/ // mode & 4: return value when already ns object
-/******/ // mode & 16: return value when it's Promise-like
-/******/ // mode & 8|1: behave like require
-/******/ __webpack_require__.t = function(value, mode) {
-/******/ if(mode & 1) value = this(value);
-/******/ if(mode & 8) return value;
-/******/ if(typeof value === 'object' && value) {
-/******/ if((mode & 4) && value.__esModule) return value;
-/******/ if((mode & 16) && typeof value.then === 'function') return value;
-/******/ }
-/******/ var ns = Object.create(null);
-/******/ __webpack_require__.r(ns);
-/******/ var def = {};
-/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
-/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
-/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
-/******/ }
-/******/ def['default'] = () => (value);
-/******/ __webpack_require__.d(ns, def);
-/******/ return ns;
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ (() => {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = (exports, definition) => {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/ensure chunk */
-/******/ (() => {
-/******/ __webpack_require__.f = {};
-/******/ // This file contains only the entry chunk.
-/******/ // The chunk loading function for additional chunks
-/******/ __webpack_require__.e = (chunkId) => {
-/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
-/******/ __webpack_require__.f[key](chunkId, promises);
-/******/ return promises;
-/******/ }, []));
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/get javascript chunk filename */
-/******/ (() => {
-/******/ // This function allow to reference async chunks
-/******/ __webpack_require__.u = (chunkId) => {
-/******/ // return url for filenames based on template
-/******/ return "" + {"0":"inner","1":"inner2","3":"normal","4":"prefetched","5":"prefetched2","6":"prefetched3"}[chunkId] + ".js";
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/get mini-css chunk filename */
-/******/ (() => {
-/******/ // This function allow to reference async chunks
-/******/ __webpack_require__.miniCssF = (chunkId) => {
-/******/ // return url for filenames based on template
-/******/ return undefined;
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/global */
-/******/ (() => {
-/******/ __webpack_require__.g = (function() {
-/******/ if (typeof globalThis === 'object') return globalThis;
-/******/ try {
-/******/ return this || new Function('return this')();
-/******/ } catch (e) {
-/******/ if (typeof window === 'object') return window;
-/******/ }
-/******/ })();
-/******/ })();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
-/******/ })();
-/******/
-/******/ /* webpack/runtime/load script */
-/******/ (() => {
-/******/ var inProgress = {};
-/******/ // data-webpack is not used as build has no uniqueName
-/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key, chunkId) => {
-/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
-/******/ var script, needAttach;
-/******/ if(key !== undefined) {
-/******/ var scripts = document.getElementsByTagName("script");
-/******/ for(var i = 0; i < scripts.length; i++) {
-/******/ var s = scripts[i];
-/******/ if(s.getAttribute("src") == url) { script = s; break; }
-/******/ }
-/******/ }
-/******/ if(!script) {
-/******/ needAttach = true;
-/******/ script = document.createElement('script');
-/******/
-/******/ script.charset = 'utf-8';
-/******/ script.timeout = 120;
-/******/ if (__webpack_require__.nc) {
-/******/ script.setAttribute("nonce", __webpack_require__.nc);
-/******/ }
-/******/
-/******/
-/******/ script.src = url;
-/******/ }
-/******/ inProgress[url] = [done];
-/******/ var onScriptComplete = (prev, event) => {
-/******/ // avoid mem leaks in IE.
-/******/ script.onerror = script.onload = null;
-/******/ clearTimeout(timeout);
-/******/ var doneFns = inProgress[url];
-/******/ delete inProgress[url];
-/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
-/******/ if(prev) return prev(event);
-/******/ }
-/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
-/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
-/******/ script.onload = onScriptComplete.bind(null, script.onload);
-/******/ needAttach && document.head.appendChild(script);
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ (() => {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = (exports) => {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/publicPath */
-/******/ (() => {
-/******/ var scriptUrl;
-/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
-/******/ var document = __webpack_require__.g.document;
-/******/ if (!scriptUrl && document) {
-/******/ if (document.currentScript)
-/******/ scriptUrl = document.currentScript.src;
-/******/ if (!scriptUrl) {
-/******/ var scripts = document.getElementsByTagName("script");
-/******/ if(scripts.length) {
-/******/ var i = scripts.length - 1;
-/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
-/******/ }
-/******/ }
-/******/ }
-/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
-/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
-/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
-/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
-/******/ __webpack_require__.p = scriptUrl;
-/******/ })();
-/******/
-/******/ /* webpack/runtime/jsonp chunk loading */
-/******/ (() => {
-/******/ // no baseURI
-/******/
-/******/ // object to store loaded and loading chunks
-/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
-/******/ var installedChunks = {
-/******/ 2: 0
-/******/ };
-/******/
-/******/ __webpack_require__.f.j = (chunkId, promises) => {
-/******/ // JSONP chunk loading for javascript
-/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
-/******/ if(installedChunkData !== 0) { // 0 means "already installed".
-/******/
-/******/ // a Promise means "currently loading".
-/******/ if(installedChunkData) {
-/******/ promises.push(installedChunkData[2]);
-/******/ } else {
-/******/ if(true) { // all chunks have JS
-/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
-/******/ promises.push(installedChunkData[2] = promise);
-/******/
-/******/ // start chunk loading
-/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
-/******/ // create error before stack unwound to get useful stacktrace later
-/******/ var error = new Error();
-/******/ var loadingEnded = (event) => {
-/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
-/******/ installedChunkData = installedChunks[chunkId];
-/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
-/******/ if(installedChunkData) {
-/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
-/******/ var realSrc = event && event.target && event.target.src;
-/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
-/******/ error.name = 'ChunkLoadError';
-/******/ error.type = errorType;
-/******/ error.request = realSrc;
-/******/ installedChunkData[1](error);
-/******/ }
-/******/ }
-/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
-/******/ }
-/******/ }
-/******/ }
-/******/ };
-/******/
-/******/ __webpack_require__.F.j = (chunkId) => {
-/******/ if((!__webpack_require__.o(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && true) {
-/******/ installedChunks[chunkId] = null;
-/******/ var link = document.createElement('link');
-/******/
-/******/ if (__webpack_require__.nc) {
-/******/ link.setAttribute("nonce", __webpack_require__.nc);
-/******/ }
-/******/ link.rel = "prefetch";
-/******/ link.as = "script";
-/******/ link.href = __webpack_require__.p + __webpack_require__.u(chunkId);
-/******/ document.head.appendChild(link);
-/******/ }
-/******/ };
-/******/
-/******/ // no preloaded
-/******/
-/******/ // no HMR
-/******/
-/******/ // no HMR manifest
-/******/
-/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
-/******/
-/******/ // install a JSONP callback for chunk loading
-/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
-/******/ var [chunkIds, moreModules, runtime] = data;
-/******/ // add "moreModules" to the modules object,
-/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0;
-/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) var result = runtime(__webpack_require__);
-/******/ }
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ for(;i < chunkIds.length; i++) {
-/******/ chunkId = chunkIds[i];
-/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ installedChunks[chunkId][0]();
-/******/ }
-/******/ installedChunks[chunkId] = 0;
-/******/ }
-/******/ return __webpack_require__.O(result);
-/******/ }
-/******/
-/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
-/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
-/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/ })();
-/******/
-/******/ /* webpack/runtime/chunk prefetch trigger */
-/******/ (() => {
-/******/ var chunkToChildrenMap = {
-/******/ "4": [
-/******/ 1,
-/******/ 0
-/******/ ]
-/******/ };
-/******/ __webpack_require__.f.prefetch = (chunkId, promises) => (Promise.all(promises).then(() => {
-/******/ var chunks = chunkToChildrenMap[chunkId];
-/******/ Array.isArray(chunks) && chunks.map(__webpack_require__.E);
-/******/ }));
-/******/ })();
-/******/
-/******/ /* webpack/runtime/startup prefetch */
-/******/ (() => {
-/******/ __webpack_require__.O(0, [2], () => {
-/******/ [5,4,6].map(__webpack_require__.E);
-/******/ }, 5);
-/******/ })();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry need to be wrapped in an IIFE because it need to be in strict mode.
-(() => {
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _with_nested__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
-/* harmony import */ var _with_nested__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_with_nested__WEBPACK_IMPORTED_MODULE_0__);
-// eslint-disable-next-line import/no-unresolved
-
-
-__webpack_require__.e(/* import() | prefetched */ 4).then(__webpack_require__.t.bind(__webpack_require__, 2, 23));
-setTimeout(() => {
- __webpack_require__.e(/* import() | normal */ 3).then(__webpack_require__.t.bind(__webpack_require__, 3, 23));
-}, 500);
-
-})();
-
-__webpack_exports__ = __webpack_require__.O(__webpack_exports__);
-/******/ })()
-;
\ No newline at end of file
diff --git a/test/cases/prefetch/expected/normal.js b/test/cases/prefetch/expected/normal.js
deleted file mode 100644
index 25608459..00000000
--- a/test/cases/prefetch/expected/normal.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[3],{
-
-/***/ 3:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch/expected/prefetched.js b/test/cases/prefetch/expected/prefetched.js
deleted file mode 100644
index 17c45d61..00000000
--- a/test/cases/prefetch/expected/prefetched.js
+++ /dev/null
@@ -1,15 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[4],{
-
-/***/ 2:
-/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
-
-setTimeout(() => {
- __webpack_require__.e(/* import() | inner */ 0).then(__webpack_require__.t.bind(__webpack_require__, 6, 23));
- __webpack_require__.e(/* import() | inner2 */ 1).then(__webpack_require__.t.bind(__webpack_require__, 7, 23));
- __webpack_require__.e(/* import() | inner2 */ 1).then(__webpack_require__.t.bind(__webpack_require__, 8, 23));
-}, 5000);
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch/expected/prefetched2.js b/test/cases/prefetch/expected/prefetched2.js
deleted file mode 100644
index 12cf8614..00000000
--- a/test/cases/prefetch/expected/prefetched2.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[5],{
-
-/***/ 4:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch/expected/prefetched3.js b/test/cases/prefetch/expected/prefetched3.js
deleted file mode 100644
index 93a9146a..00000000
--- a/test/cases/prefetch/expected/prefetched3.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[6],{
-
-/***/ 5:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/prefetch/index.js b/test/cases/prefetch/index.js
deleted file mode 100644
index 34275c6b..00000000
--- a/test/cases/prefetch/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-// eslint-disable-next-line import/no-unresolved
-import "./with-nested";
-
-import(/* webpackPrefetch: 1, webpackChunkName: "prefetched" */ "./prefetched");
-setTimeout(() => {
- import(/* webpackChunkName: "normal" */ "./normal");
-}, 500);
diff --git a/test/cases/prefetch/inner.js b/test/cases/prefetch/inner.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/prefetch/inner2.js b/test/cases/prefetch/inner2.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/prefetch/inner3.js b/test/cases/prefetch/inner3.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/prefetch/normal.js b/test/cases/prefetch/normal.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/prefetch/prefetched.js b/test/cases/prefetch/prefetched.js
deleted file mode 100644
index b895d1e3..00000000
--- a/test/cases/prefetch/prefetched.js
+++ /dev/null
@@ -1,5 +0,0 @@
-setTimeout(() => {
- import(/* webpackPrefetch: 10, webpackChunkName: "inner" */ "./inner");
- import(/* webpackPrefetch: 20, webpackChunkName: "inner2" */ "./inner2");
- import(/* webpackChunkName: "inner2" */ "./inner3");
-}, 5000);
diff --git a/test/cases/prefetch/prefetched2.js b/test/cases/prefetch/prefetched2.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/prefetch/prefetched3.js b/test/cases/prefetch/prefetched3.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/prefetch/webpack.config.js b/test/cases/prefetch/webpack.config.js
deleted file mode 100644
index cf55c08c..00000000
--- a/test/cases/prefetch/webpack.config.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import Self from "../../../src";
-
-module.exports = {
- entry: "./index.js",
- module: {
- rules: [
- {
- test: /\.css$/,
- use: [Self.loader, "css-loader"],
- },
- ],
- },
- plugins: [
- new Self({
- filename: "[name].css",
- }),
- ],
-};
diff --git a/test/cases/prefetch/with-nested.js b/test/cases/prefetch/with-nested.js
deleted file mode 100644
index a8d638ad..00000000
--- a/test/cases/prefetch/with-nested.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import(
- /* webpackPrefetch: -20, webpackChunkName: "prefetched2" */ "./prefetched2"
-);
-import(
- /* webpackPrefetch: 3, webpackChunkName: "prefetched2" */ "./prefetched2"
-);
-import(
- /* webpackPrefetch: -10, webpackChunkName: "prefetched3" */ "./prefetched3"
-);
diff --git a/test/cases/preload/expected/inner.js b/test/cases/preload/expected/inner.js
deleted file mode 100644
index 49ef065a..00000000
--- a/test/cases/preload/expected/inner.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[0],{
-
-/***/ 6:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/preload/expected/inner2.js b/test/cases/preload/expected/inner2.js
deleted file mode 100644
index 9eff91f7..00000000
--- a/test/cases/preload/expected/inner2.js
+++ /dev/null
@@ -1,17 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[1],{
-
-/***/ 7:
-/***/ (() => {
-
-
-
-/***/ }),
-
-/***/ 8:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/preload/expected/main.js b/test/cases/preload/expected/main.js
deleted file mode 100644
index 597eae1b..00000000
--- a/test/cases/preload/expected/main.js
+++ /dev/null
@@ -1,372 +0,0 @@
-/******/ (() => { // webpackBootstrap
-/******/ var __webpack_modules__ = ([
-/* 0 */,
-/* 1 */
-/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
-
-__webpack_require__.e(/* import() | preloaded2 */ 5).then(__webpack_require__.t.bind(__webpack_require__, 4, 23));
-__webpack_require__.e(/* import() | preloaded2 */ 5).then(__webpack_require__.t.bind(__webpack_require__, 4, 23));
-__webpack_require__.e(/* import() | preloaded3 */ 6).then(__webpack_require__.t.bind(__webpack_require__, 5, 23));
-
-
-/***/ })
-/******/ ]);
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.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;
-/******/ }
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = __webpack_modules__;
-/******/
-/************************************************************************/
-/******/ /* webpack/runtime/chunk preload function */
-/******/ (() => {
-/******/ __webpack_require__.H = {};
-/******/ __webpack_require__.G = (chunkId) => {
-/******/ Object.keys(__webpack_require__.H).map((key) => {
-/******/ __webpack_require__.H[key](chunkId);
-/******/ });
-/******/ }
-/******/ })();
-/******/
-/******/ /* webpack/runtime/compat get default export */
-/******/ (() => {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = (module) => {
-/******/ var getter = module && module.__esModule ?
-/******/ () => (module['default']) :
-/******/ () => (module);
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/create fake namespace object */
-/******/ (() => {
-/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
-/******/ var leafPrototypes;
-/******/ // create a fake namespace object
-/******/ // mode & 1: value is a module id, require it
-/******/ // mode & 2: merge all properties of value into the ns
-/******/ // mode & 4: return value when already ns object
-/******/ // mode & 16: return value when it's Promise-like
-/******/ // mode & 8|1: behave like require
-/******/ __webpack_require__.t = function(value, mode) {
-/******/ if(mode & 1) value = this(value);
-/******/ if(mode & 8) return value;
-/******/ if(typeof value === 'object' && value) {
-/******/ if((mode & 4) && value.__esModule) return value;
-/******/ if((mode & 16) && typeof value.then === 'function') return value;
-/******/ }
-/******/ var ns = Object.create(null);
-/******/ __webpack_require__.r(ns);
-/******/ var def = {};
-/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
-/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
-/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
-/******/ }
-/******/ def['default'] = () => (value);
-/******/ __webpack_require__.d(ns, def);
-/******/ return ns;
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/define property getters */
-/******/ (() => {
-/******/ // define getter functions for harmony exports
-/******/ __webpack_require__.d = (exports, definition) => {
-/******/ for(var key in definition) {
-/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
-/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
-/******/ }
-/******/ }
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/ensure chunk */
-/******/ (() => {
-/******/ __webpack_require__.f = {};
-/******/ // This file contains only the entry chunk.
-/******/ // The chunk loading function for additional chunks
-/******/ __webpack_require__.e = (chunkId) => {
-/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
-/******/ __webpack_require__.f[key](chunkId, promises);
-/******/ return promises;
-/******/ }, []));
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/get javascript chunk filename */
-/******/ (() => {
-/******/ // This function allow to reference async chunks
-/******/ __webpack_require__.u = (chunkId) => {
-/******/ // return url for filenames based on template
-/******/ return "" + {"0":"inner","1":"inner2","3":"normal","4":"preloaded","5":"preloaded2","6":"preloaded3"}[chunkId] + ".js";
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/get mini-css chunk filename */
-/******/ (() => {
-/******/ // This function allow to reference async chunks
-/******/ __webpack_require__.miniCssF = (chunkId) => {
-/******/ // return url for filenames based on template
-/******/ return undefined;
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/global */
-/******/ (() => {
-/******/ __webpack_require__.g = (function() {
-/******/ if (typeof globalThis === 'object') return globalThis;
-/******/ try {
-/******/ return this || new Function('return this')();
-/******/ } catch (e) {
-/******/ if (typeof window === 'object') return window;
-/******/ }
-/******/ })();
-/******/ })();
-/******/
-/******/ /* webpack/runtime/hasOwnProperty shorthand */
-/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
-/******/ })();
-/******/
-/******/ /* webpack/runtime/load script */
-/******/ (() => {
-/******/ var inProgress = {};
-/******/ // data-webpack is not used as build has no uniqueName
-/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key, chunkId) => {
-/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
-/******/ var script, needAttach;
-/******/ if(key !== undefined) {
-/******/ var scripts = document.getElementsByTagName("script");
-/******/ for(var i = 0; i < scripts.length; i++) {
-/******/ var s = scripts[i];
-/******/ if(s.getAttribute("src") == url) { script = s; break; }
-/******/ }
-/******/ }
-/******/ if(!script) {
-/******/ needAttach = true;
-/******/ script = document.createElement('script');
-/******/
-/******/ script.charset = 'utf-8';
-/******/ script.timeout = 120;
-/******/ if (__webpack_require__.nc) {
-/******/ script.setAttribute("nonce", __webpack_require__.nc);
-/******/ }
-/******/
-/******/
-/******/ script.src = url;
-/******/ }
-/******/ inProgress[url] = [done];
-/******/ var onScriptComplete = (prev, event) => {
-/******/ // avoid mem leaks in IE.
-/******/ script.onerror = script.onload = null;
-/******/ clearTimeout(timeout);
-/******/ var doneFns = inProgress[url];
-/******/ delete inProgress[url];
-/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
-/******/ if(prev) return prev(event);
-/******/ }
-/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
-/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
-/******/ script.onload = onScriptComplete.bind(null, script.onload);
-/******/ needAttach && document.head.appendChild(script);
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/make namespace object */
-/******/ (() => {
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = (exports) => {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/ })();
-/******/
-/******/ /* webpack/runtime/publicPath */
-/******/ (() => {
-/******/ var scriptUrl;
-/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
-/******/ var document = __webpack_require__.g.document;
-/******/ if (!scriptUrl && document) {
-/******/ if (document.currentScript)
-/******/ scriptUrl = document.currentScript.src;
-/******/ if (!scriptUrl) {
-/******/ var scripts = document.getElementsByTagName("script");
-/******/ if(scripts.length) {
-/******/ var i = scripts.length - 1;
-/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
-/******/ }
-/******/ }
-/******/ }
-/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
-/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
-/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
-/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
-/******/ __webpack_require__.p = scriptUrl;
-/******/ })();
-/******/
-/******/ /* webpack/runtime/jsonp chunk loading */
-/******/ (() => {
-/******/ // no baseURI
-/******/
-/******/ // object to store loaded and loading chunks
-/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
-/******/ var installedChunks = {
-/******/ 2: 0
-/******/ };
-/******/
-/******/ __webpack_require__.f.j = (chunkId, promises) => {
-/******/ // JSONP chunk loading for javascript
-/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
-/******/ if(installedChunkData !== 0) { // 0 means "already installed".
-/******/
-/******/ // a Promise means "currently loading".
-/******/ if(installedChunkData) {
-/******/ promises.push(installedChunkData[2]);
-/******/ } else {
-/******/ if(true) { // all chunks have JS
-/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
-/******/ promises.push(installedChunkData[2] = promise);
-/******/
-/******/ // start chunk loading
-/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
-/******/ // create error before stack unwound to get useful stacktrace later
-/******/ var error = new Error();
-/******/ var loadingEnded = (event) => {
-/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
-/******/ installedChunkData = installedChunks[chunkId];
-/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
-/******/ if(installedChunkData) {
-/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
-/******/ var realSrc = event && event.target && event.target.src;
-/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
-/******/ error.name = 'ChunkLoadError';
-/******/ error.type = errorType;
-/******/ error.request = realSrc;
-/******/ installedChunkData[1](error);
-/******/ }
-/******/ }
-/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
-/******/ }
-/******/ }
-/******/ }
-/******/ };
-/******/
-/******/ // no prefetching
-/******/
-/******/ __webpack_require__.H.j = (chunkId) => {
-/******/ if((!__webpack_require__.o(installedChunks, chunkId) || installedChunks[chunkId] === undefined) && true) {
-/******/ installedChunks[chunkId] = null;
-/******/ var link = document.createElement('link');
-/******/
-/******/ link.charset = 'utf-8';
-/******/ if (__webpack_require__.nc) {
-/******/ link.setAttribute("nonce", __webpack_require__.nc);
-/******/ }
-/******/ link.rel = "preload";
-/******/ link.as = "script";
-/******/ link.href = __webpack_require__.p + __webpack_require__.u(chunkId);
-/******/ document.head.appendChild(link);
-/******/ }
-/******/ };
-/******/
-/******/ // no HMR
-/******/
-/******/ // no HMR manifest
-/******/
-/******/ // no on chunks loaded
-/******/
-/******/ // install a JSONP callback for chunk loading
-/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
-/******/ var [chunkIds, moreModules, runtime] = data;
-/******/ // add "moreModules" to the modules object,
-/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0;
-/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) var result = runtime(__webpack_require__);
-/******/ }
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ for(;i < chunkIds.length; i++) {
-/******/ chunkId = chunkIds[i];
-/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ installedChunks[chunkId][0]();
-/******/ }
-/******/ installedChunks[chunkId] = 0;
-/******/ }
-/******/
-/******/ }
-/******/
-/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
-/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
-/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/ })();
-/******/
-/******/ /* webpack/runtime/chunk preload trigger */
-/******/ (() => {
-/******/ var chunkToChildrenMap = {
-/******/ "4": [
-/******/ 1,
-/******/ 0
-/******/ ]
-/******/ };
-/******/ __webpack_require__.f.preload = (chunkId) => {
-/******/ var chunks = chunkToChildrenMap[chunkId];
-/******/ Array.isArray(chunks) && chunks.map(__webpack_require__.G);
-/******/ };
-/******/ })();
-/******/
-/************************************************************************/
-var __webpack_exports__ = {};
-// This entry need to be wrapped in an IIFE because it need to be in strict mode.
-(() => {
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _with_nested__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
-/* harmony import */ var _with_nested__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_with_nested__WEBPACK_IMPORTED_MODULE_0__);
-// eslint-disable-next-line import/no-unresolved
-
-
-__webpack_require__.e(/* import() | preloaded */ 4).then(__webpack_require__.t.bind(__webpack_require__, 2, 23));
-setTimeout(() => {
- __webpack_require__.e(/* import() | normal */ 3).then(__webpack_require__.t.bind(__webpack_require__, 3, 23));
-}, 500);
-
-})();
-
-/******/ })()
-;
\ No newline at end of file
diff --git a/test/cases/preload/expected/normal.js b/test/cases/preload/expected/normal.js
deleted file mode 100644
index 25608459..00000000
--- a/test/cases/preload/expected/normal.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[3],{
-
-/***/ 3:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/preload/expected/preloaded.js b/test/cases/preload/expected/preloaded.js
deleted file mode 100644
index 17c45d61..00000000
--- a/test/cases/preload/expected/preloaded.js
+++ /dev/null
@@ -1,15 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[4],{
-
-/***/ 2:
-/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
-
-setTimeout(() => {
- __webpack_require__.e(/* import() | inner */ 0).then(__webpack_require__.t.bind(__webpack_require__, 6, 23));
- __webpack_require__.e(/* import() | inner2 */ 1).then(__webpack_require__.t.bind(__webpack_require__, 7, 23));
- __webpack_require__.e(/* import() | inner2 */ 1).then(__webpack_require__.t.bind(__webpack_require__, 8, 23));
-}, 5000);
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/preload/expected/preloaded2.js b/test/cases/preload/expected/preloaded2.js
deleted file mode 100644
index 12cf8614..00000000
--- a/test/cases/preload/expected/preloaded2.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[5],{
-
-/***/ 4:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/preload/expected/preloaded3.js b/test/cases/preload/expected/preloaded3.js
deleted file mode 100644
index 93a9146a..00000000
--- a/test/cases/preload/expected/preloaded3.js
+++ /dev/null
@@ -1,10 +0,0 @@
-(self["webpackChunk"] = self["webpackChunk"] || []).push([[6],{
-
-/***/ 5:
-/***/ (() => {
-
-
-
-/***/ })
-
-}]);
\ No newline at end of file
diff --git a/test/cases/preload/index.js b/test/cases/preload/index.js
deleted file mode 100644
index bba8e969..00000000
--- a/test/cases/preload/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-// eslint-disable-next-line import/no-unresolved
-import "./with-nested";
-
-import(/* webpackPreload: 1, webpackChunkName: "preloaded" */ "./preloaded");
-setTimeout(() => {
- import(/* webpackChunkName: "normal" */ "./normal");
-}, 500);
diff --git a/test/cases/preload/inner.js b/test/cases/preload/inner.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/preload/inner2.js b/test/cases/preload/inner2.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/preload/inner3.js b/test/cases/preload/inner3.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/preload/normal.js b/test/cases/preload/normal.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/preload/preloaded.js b/test/cases/preload/preloaded.js
deleted file mode 100644
index c676cd7a..00000000
--- a/test/cases/preload/preloaded.js
+++ /dev/null
@@ -1,5 +0,0 @@
-setTimeout(() => {
- import(/* webpackPreload: 10, webpackChunkName: "inner" */ "./inner");
- import(/* webpackPreload: 20, webpackChunkName: "inner2" */ "./inner2");
- import(/* webpackChunkName: "inner2" */ "./inner3");
-}, 5000);
diff --git a/test/cases/preload/preloaded2.js b/test/cases/preload/preloaded2.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/preload/preloaded3.js b/test/cases/preload/preloaded3.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cases/preload/webpack.config.js b/test/cases/preload/webpack.config.js
deleted file mode 100644
index cf55c08c..00000000
--- a/test/cases/preload/webpack.config.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import Self from "../../../src";
-
-module.exports = {
- entry: "./index.js",
- module: {
- rules: [
- {
- test: /\.css$/,
- use: [Self.loader, "css-loader"],
- },
- ],
- },
- plugins: [
- new Self({
- filename: "[name].css",
- }),
- ],
-};
diff --git a/test/cases/preload/with-nested.js b/test/cases/preload/with-nested.js
deleted file mode 100644
index 8f23fcf1..00000000
--- a/test/cases/preload/with-nested.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import(
- /* webpackPreload: -20, webpackChunkName: "preloaded2" */ "./preloaded2"
-);
-import(/* webpackPreload: 3, webpackChunkName: "preloaded2" */ "./preloaded2");
-import(
- /* webpackPreload: -10, webpackChunkName: "preloaded3" */ "./preloaded3"
-);
diff --git a/test/manual/index.html b/test/manual/index.html
index 3b7d2ca4..8c93cb71 100644
--- a/test/manual/index.html
+++ b/test/manual/index.html
@@ -23,6 +23,16 @@
background: lightgreen;
}
+
+
@@ -97,6 +107,20 @@
+
+
Prefetch CSS: Must be blue and green after click.
+
+ to load
+ prefetched chunk
+
+
+
+
Preload CSS: Must be white, then blue, then green after click.
+
+ to load
+ preloaded chunk
+
+