-
-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add semicolon to avoid
Uncaught TypeError
on Webpack v5 (#561)
- Loading branch information
Showing
24 changed files
with
586 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './styleA.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './styleB.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './styleC.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './styleD.css'; |
8 changes: 8 additions & 0 deletions
8
test/cases/dependOn-multiple-files-per-entry/expected/webpack-5/common.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.styleC { | ||
background: red; | ||
} | ||
|
||
.styleD { | ||
background: blue; | ||
} | ||
|
214 changes: 214 additions & 0 deletions
214
test/cases/dependOn-multiple-files-per-entry/expected/webpack-5/common.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
/******/ (() => { // webpackBootstrap | ||
/******/ var __webpack_modules__ = ([ | ||
/* 0 */ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
|
||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony import */ var _styleC_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); | ||
/* harmony import */ var _styleC_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_styleC_css__WEBPACK_IMPORTED_MODULE_0__); | ||
|
||
|
||
|
||
/***/ }), | ||
/* 1 */ | ||
/***/ (() => { | ||
|
||
// extracted by mini-css-extract-plugin | ||
|
||
/***/ }), | ||
/* 2 */ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
|
||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony import */ var _styleD_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); | ||
/* harmony import */ var _styleD_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_styleD_css__WEBPACK_IMPORTED_MODULE_0__); | ||
|
||
|
||
|
||
/***/ }), | ||
/* 3 */ | ||
/***/ (() => { | ||
|
||
// 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; | ||
/******/ } | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = __webpack_modules__; | ||
/******/ | ||
/************************************************************************/ | ||
/******/ /* 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/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/hasOwnProperty shorthand */ | ||
/******/ (() => { | ||
/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) | ||
/******/ })(); | ||
/******/ | ||
/******/ /* 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/compat */ | ||
/******/ | ||
/******/ | ||
/******/ // object to store loaded CSS chunks | ||
/******/ var installedCssChunks = { | ||
/******/ 0: 0 | ||
/******/ };/* webpack/runtime/jsonp chunk loading */ | ||
/******/ (() => { | ||
/******/ // object to store loaded and loading chunks | ||
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched | ||
/******/ // Promise = chunk loading, 0 = chunk loaded | ||
/******/ var installedChunks = { | ||
/******/ 0: 0 | ||
/******/ }; | ||
/******/ | ||
/******/ var deferredModules = [ | ||
/******/ [0], | ||
/******/ [2] | ||
/******/ ]; | ||
/******/ // no chunk on demand loading | ||
/******/ | ||
/******/ // no prefetching | ||
/******/ | ||
/******/ // no preloaded | ||
/******/ | ||
/******/ // no HMR | ||
/******/ | ||
/******/ // no HMR manifest | ||
/******/ | ||
/******/ var checkDeferredModules = () => { | ||
/******/ | ||
/******/ }; | ||
/******/ function checkDeferredModulesImpl() { | ||
/******/ var result; | ||
/******/ for(var i = 0; i < deferredModules.length; i++) { | ||
/******/ var deferredModule = deferredModules[i]; | ||
/******/ var fulfilled = true; | ||
/******/ for(var j = 1; j < deferredModule.length; j++) { | ||
/******/ var depId = deferredModule[j]; | ||
/******/ if(installedChunks[depId] !== 0) fulfilled = false; | ||
/******/ } | ||
/******/ if(fulfilled) { | ||
/******/ deferredModules.splice(i--, 1); | ||
/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); | ||
/******/ } | ||
/******/ } | ||
/******/ if(deferredModules.length === 0) { | ||
/******/ __webpack_require__.x(); | ||
/******/ __webpack_require__.x = () => { | ||
/******/ | ||
/******/ } | ||
/******/ } | ||
/******/ return result; | ||
/******/ } | ||
/******/ __webpack_require__.x = () => { | ||
/******/ // reset startup function so it can be called again when more startup code is added | ||
/******/ __webpack_require__.x = () => { | ||
/******/ | ||
/******/ } | ||
/******/ jsonpArray = jsonpArray.slice(); | ||
/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); | ||
/******/ return (checkDeferredModules = checkDeferredModulesImpl)(); | ||
/******/ }; | ||
/******/ | ||
/******/ // install a JSONP callback for chunk loading | ||
/******/ function webpackJsonpCallback(data) { | ||
/******/ var chunkIds = data[0]; | ||
/******/ var moreModules = data[1]; | ||
/******/ var executeModules = data[2]; | ||
/******/ var runtime = data[3]; | ||
/******/ // add "moreModules" to the modules object, | ||
/******/ // then flag all "chunkIds" as loaded and fire callback | ||
/******/ var moduleId, chunkId, i = 0, resolves = []; | ||
/******/ for(;i < chunkIds.length; i++) { | ||
/******/ chunkId = chunkIds[i]; | ||
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { | ||
/******/ resolves.push(installedChunks[chunkId][0]); | ||
/******/ } | ||
/******/ installedChunks[chunkId] = 0; | ||
/******/ } | ||
/******/ for(moduleId in moreModules) { | ||
/******/ if(__webpack_require__.o(moreModules, moduleId)) { | ||
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; | ||
/******/ } | ||
/******/ } | ||
/******/ if(runtime) runtime(__webpack_require__); | ||
/******/ if(parentJsonpFunction) parentJsonpFunction(data); | ||
/******/ while(resolves.length) { | ||
/******/ resolves.shift()(); | ||
/******/ } | ||
/******/ | ||
/******/ // add entry modules from loaded chunk to deferred list | ||
/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules); | ||
/******/ | ||
/******/ // run deferred modules when all chunks ready | ||
/******/ return checkDeferredModules(); | ||
/******/ }; | ||
/******/ | ||
/******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; | ||
/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); | ||
/******/ jsonpArray.push = webpackJsonpCallback; | ||
/******/ var parentJsonpFunction = oldJsonpFunction; | ||
/******/ })(); | ||
/******/ | ||
/************************************************************************/ | ||
/******/ // run startup | ||
/******/ return __webpack_require__.x(); | ||
/******/ })() | ||
; |
8 changes: 8 additions & 0 deletions
8
test/cases/dependOn-multiple-files-per-entry/expected/webpack-5/entry1.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.styleB { | ||
background: blue; | ||
} | ||
|
||
.styleA { | ||
background: red; | ||
} | ||
|
40 changes: 40 additions & 0 deletions
40
test/cases/dependOn-multiple-files-per-entry/expected/webpack-5/entry1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[1],[ | ||
/* 0 */, | ||
/* 1 */, | ||
/* 2 */, | ||
/* 3 */, | ||
/* 4 */ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
|
||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony import */ var _styleB_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5); | ||
/* harmony import */ var _styleB_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_styleB_css__WEBPACK_IMPORTED_MODULE_0__); | ||
|
||
|
||
|
||
/***/ }), | ||
/* 5 */ | ||
/***/ (() => { | ||
|
||
// extracted by mini-css-extract-plugin | ||
|
||
/***/ }), | ||
/* 6 */ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
|
||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony import */ var _styleA_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7); | ||
/* harmony import */ var _styleA_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_styleA_css__WEBPACK_IMPORTED_MODULE_0__); | ||
|
||
|
||
|
||
/***/ }), | ||
/* 7 */ | ||
/***/ (() => { | ||
|
||
// extracted by mini-css-extract-plugin | ||
|
||
/***/ }) | ||
],[[6,0],[4,0]]]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.styleA { | ||
background: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.styleB { | ||
background: blue; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.styleC { | ||
background: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.styleD { | ||
background: blue; | ||
} |
21 changes: 21 additions & 0 deletions
21
test/cases/dependOn-multiple-files-per-entry/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Self from '../../../src'; | ||
|
||
module.exports = { | ||
entry: { | ||
entry1: { import: ['./entryA.js', './entryB.js'], dependOn: 'common' }, | ||
common: ['./entryC.js', './entryD.js'], | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [Self.loader, 'css-loader'], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new Self({ | ||
filename: '[name].css', | ||
}), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './styleA.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './styleB.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.styleB { | ||
background: blue; | ||
} | ||
|
Oops, something went wrong.