Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't use initialize hooks to allow dynamic plugin injection #1862

Merged
merged 6 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
cache: "npm"

- name: Install dependencies
run: npm ci
run: npm ci --legacy-peer-deps

- name: Lint
run: npm run lint
Expand All @@ -54,7 +54,7 @@ jobs:
runs-on: ${{ matrix.os }}

concurrency:
group: test-${{ matrix.os }}-v${{ matrix.node-version }}-${{ matrix.webpack-version }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ matrix.os }}-v${{ matrix.node }}-${{ matrix.webpack }}-${{ github.ref }}
cancel-in-progress: true

strategy:
Expand All @@ -77,11 +77,11 @@ jobs:
cache: "npm"

- name: Install dependencies
run: npm ci
run: npm ci --legacy-peer-deps

- name: Install webpack ${{ matrix.webpack-version }}
if: matrix.webpack-version != 'latest'
run: npm i webpack@${{ matrix.webpack-version }}
run: npm i webpack@${{ matrix.webpack-version }} --legacy-peer-deps

- name: Run tests for webpack version ${{ matrix.webpack-version }}
run: npm run test:coverage -- --ci
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[488],{
(self["webpackChunk"] = self["webpackChunk"] || []).push([[192],{

/***/ 432:
/***/ 810:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ c: () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(849);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(935);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);
// Imports

Expand All @@ -20,16 +20,16 @@ ___CSS_LOADER_EXPORT___.push([module.id, "body {\n background: snow;\n}\n", ""]

/***/ }),

/***/ 488:
/***/ 192:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(108);
/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(591);
/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(432);
/* harmony import */ var _node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(810);



Expand All @@ -38,11 +38,11 @@ var options = {};
options.insert = "head";
options.singleton = false;

var update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .c, options);
var update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A, options);



/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .c.locals || {});
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.locals || {});

/***/ })

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[980],{
(self["webpackChunk"] = self["webpackChunk"] || []).push([[461],{

/***/ 849:
/***/ 935:
/***/ ((module) => {


Expand Down Expand Up @@ -73,7 +73,7 @@ module.exports = function (cssWithMappingToString) {

/***/ }),

/***/ 108:
/***/ 591:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {


Expand Down
2 changes: 1 addition & 1 deletion examples/chunk-optimization/dist/webpack-5/entryA.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html><head><meta charset="utf-8"><title>Webpack App</title><meta name="viewport" content="width=device-width,initial-scale=1"><script defer="defer" src="libMath.js"></script><script defer="defer" src="libText.js"></script><script defer="defer" src="980.js"></script><script defer="defer" src="488.js"></script><script defer="defer" src="entryA.js"></script></head><body></body></html>
<!doctype html><html><head><meta charset="utf-8"><title>Webpack App</title><meta name="viewport" content="width=device-width,initial-scale=1"><script defer="defer" src="libMath.js"></script><script defer="defer" src="libText.js"></script><script defer="defer" src="461.js"></script><script defer="defer" src="192.js"></script><script defer="defer" src="entryA.js"></script></head><body></body></html>
12 changes: 6 additions & 6 deletions examples/chunk-optimization/dist/webpack-5/entryA.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ 67:
/***/ 910:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {

__webpack_require__(488);
var multiply = __webpack_require__(540);
var concat = __webpack_require__(280);
__webpack_require__(192);
var multiply = __webpack_require__(199);
var concat = __webpack_require__(631);
var h1 = document.createElement("h1");
h1.innerHTML = concat("Hello world from Entry ", multiply(1, 1));
document.body.appendChild(h1);
Expand Down Expand Up @@ -124,7 +124,7 @@ document.body.appendChild(h1);
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 568: 0
/******/ 570: 0
/******/ };
/******/
/******/ // no chunk on demand loading
Expand Down Expand Up @@ -179,7 +179,7 @@ document.body.appendChild(h1);
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, [288,8,980,488], () => (__webpack_require__(67)))
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, [646,209,461,192], () => (__webpack_require__(910)))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/
/******/ })()
Expand Down
2 changes: 1 addition & 1 deletion examples/chunk-optimization/dist/webpack-5/entryB.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html><head><meta charset="utf-8"><title>Webpack App</title><meta name="viewport" content="width=device-width,initial-scale=1"><script defer="defer" src="libMath.js"></script><script defer="defer" src="980.js"></script><script defer="defer" src="488.js"></script><script defer="defer" src="entryB.js"></script></head><body></body></html>
<!doctype html><html><head><meta charset="utf-8"><title>Webpack App</title><meta name="viewport" content="width=device-width,initial-scale=1"><script defer="defer" src="libMath.js"></script><script defer="defer" src="461.js"></script><script defer="defer" src="192.js"></script><script defer="defer" src="entryB.js"></script></head><body></body></html>
10 changes: 5 additions & 5 deletions examples/chunk-optimization/dist/webpack-5/entryB.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ 304:
/***/ 123:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {

__webpack_require__(488);
var multiply = __webpack_require__(540);
__webpack_require__(192);
var multiply = __webpack_require__(199);
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world from Entry " + multiply(1, 2);
document.body.appendChild(h1);
Expand Down Expand Up @@ -123,7 +123,7 @@ document.body.appendChild(h1);
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 758: 0
/******/ 761: 0
/******/ };
/******/
/******/ // no chunk on demand loading
Expand Down Expand Up @@ -178,7 +178,7 @@ document.body.appendChild(h1);
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, [288,980,488], () => (__webpack_require__(304)))
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, [646,461,192], () => (__webpack_require__(123)))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/
/******/ })()
Expand Down
2 changes: 1 addition & 1 deletion examples/chunk-optimization/dist/webpack-5/entryC.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html><head><meta charset="utf-8"><title>Webpack App</title><meta name="viewport" content="width=device-width,initial-scale=1"><script defer="defer" src="libMath.js"></script><script defer="defer" src="libText.js"></script><script defer="defer" src="980.js"></script><script defer="defer" src="488.js"></script><script defer="defer" src="entryA.js"></script><script defer="defer" src="entryB.js"></script></head><body></body></html>
<!doctype html><html><head><meta charset="utf-8"><title>Webpack App</title><meta name="viewport" content="width=device-width,initial-scale=1"><script defer="defer" src="libMath.js"></script><script defer="defer" src="libText.js"></script><script defer="defer" src="461.js"></script><script defer="defer" src="192.js"></script><script defer="defer" src="entryA.js"></script><script defer="defer" src="entryB.js"></script></head><body></body></html>
8 changes: 4 additions & 4 deletions examples/chunk-optimization/dist/webpack-5/libMath.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(self["webpackChunk"] = self["webpackChunk"] || []).push([[288],{
(self["webpackChunk"] = self["webpackChunk"] || []).push([[646],{

/***/ 540:
/***/ 199:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var sum = __webpack_require__(636);
var sum = __webpack_require__(16);
module.exports = function multiply(a, b) {
var m = 0;
for (var i = 0; i < a; i = sum(i, 1)) {
Expand All @@ -15,7 +15,7 @@ module.exports = function multiply(a, b) {

/***/ }),

/***/ 636:
/***/ 16:
/***/ ((module) => {

module.exports = function sum(a, b) {
Expand Down
4 changes: 2 additions & 2 deletions examples/chunk-optimization/dist/webpack-5/libText.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(self["webpackChunk"] = self["webpackChunk"] || []).push([[8],{
(self["webpackChunk"] = self["webpackChunk"] || []).push([[209],{

/***/ 280:
/***/ 631:
/***/ ((module) => {

module.exports = function concat(a, b) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/******/ (() => { // webpackBootstrap
var __webpack_exports__ = {};
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);
Expand Down
8 changes: 2 additions & 6 deletions examples/custom-template/dist/webpack-5/bundle.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ 268:
/***/ 969:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
Expand Down Expand Up @@ -51,14 +51,10 @@ __webpack_require__.r(__webpack_exports__);
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
__webpack_require__(268);
__webpack_require__(969);
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);

})();

/******/ })()
;
26 changes: 11 additions & 15 deletions examples/default/dist/webpack-5/bundle.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ 432:
/***/ 810:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ c: () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(849);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(935);
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);
// Imports

Expand All @@ -21,7 +21,7 @@ ___CSS_LOADER_EXPORT___.push([module.id, "body {\n background: snow;\n}\n", ""]

/***/ }),

/***/ 849:
/***/ 935:
/***/ ((module) => {

"use strict";
Expand Down Expand Up @@ -94,17 +94,17 @@ module.exports = function (cssWithMappingToString) {

/***/ }),

/***/ 488:
/***/ 192:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(108);
/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(591);
/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(432);
/* harmony import */ var _node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(810);



Expand All @@ -113,15 +113,15 @@ var options = {};
options.insert = "head";
options.singleton = false;

var update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .c, options);
var update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A, options);



/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .c.locals || {});
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_main_css__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A.locals || {});

/***/ }),

/***/ 108:
/***/ 591:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";
Expand Down Expand Up @@ -471,14 +471,10 @@ module.exports = function (list, options) {
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
__webpack_require__(488);
__webpack_require__(192);
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);

})();

/******/ })()
;
8 changes: 2 additions & 6 deletions examples/favicon/dist/webpack-5/bundle.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ 268:
/***/ 969:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
Expand Down Expand Up @@ -51,14 +51,10 @@ __webpack_require__.r(__webpack_exports__);
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
__webpack_require__(268);
__webpack_require__(969);
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);

})();

/******/ })()
;
8 changes: 2 additions & 6 deletions examples/html-loader/dist/webpack-5/bundle.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ 268:
/***/ 969:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
Expand Down Expand Up @@ -51,14 +51,10 @@ __webpack_require__.r(__webpack_exports__);
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
__webpack_require__(268);
__webpack_require__(969);
var h1 = document.createElement("h1");
h1.innerHTML = "Hello world!";
document.body.appendChild(h1);

})();

/******/ })()
;
Loading
Loading