From cd5bd2afc902bbe5a5ceec4756ef634a26aa1332 Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Wed, 14 Oct 2020 16:39:27 +0200 Subject: [PATCH] feat: add [name] for file names --- examples/multi-page/dist/webpack-5/first.html | 1 + examples/multi-page/dist/webpack-5/first.js | 669 ++++++++++++++++++ .../multi-page/dist/webpack-5/second.html | 1 + examples/multi-page/dist/webpack-5/second.js | 669 ++++++++++++++++++ examples/multi-page/first.js | 4 + examples/multi-page/main.css | 3 + examples/multi-page/readme.md | 3 + examples/multi-page/second.js | 4 + examples/multi-page/webpack.config.js | 27 + index.js | 13 +- spec/example.spec.js | 4 + 11 files changed, 1397 insertions(+), 1 deletion(-) create mode 100644 examples/multi-page/dist/webpack-5/first.html create mode 100644 examples/multi-page/dist/webpack-5/first.js create mode 100644 examples/multi-page/dist/webpack-5/second.html create mode 100644 examples/multi-page/dist/webpack-5/second.js create mode 100755 examples/multi-page/first.js create mode 100644 examples/multi-page/main.css create mode 100644 examples/multi-page/readme.md create mode 100755 examples/multi-page/second.js create mode 100755 examples/multi-page/webpack.config.js diff --git a/examples/multi-page/dist/webpack-5/first.html b/examples/multi-page/dist/webpack-5/first.html new file mode 100644 index 00000000..930ee6eb --- /dev/null +++ b/examples/multi-page/dist/webpack-5/first.html @@ -0,0 +1 @@ +Webpack App \ No newline at end of file diff --git a/examples/multi-page/dist/webpack-5/first.js b/examples/multi-page/dist/webpack-5/first.js new file mode 100644 index 00000000..fe5242fb --- /dev/null +++ b/examples/multi-page/dist/webpack-5/first.js @@ -0,0 +1,669 @@ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 173: +/***/ ((module, exports, __webpack_require__) => { + +exports = module.exports = __webpack_require__(609)(false); +// Module +exports.push([module.id, "body {\n background: snow;\n}", ""]); + + + +/***/ }), + +/***/ 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 + ' */'; +} + +/***/ }), + +/***/ 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) {} + +/***/ }), + +/***/ 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