From a3b59785d369250efaf640b83b62e5983bf517c5 Mon Sep 17 00:00:00 2001 From: arturovt Date: Fri, 19 Apr 2024 18:27:04 +0300 Subject: [PATCH] fix: `assertNotInAngularZone` should act as a noop --- libs/single-spa-angular/src/single-spa-angular.ts | 1 + .../webpack/webpack-5/remove-mini-css-extract.ts | 8 +++++++- .../webpack/webpack-5/styleTagTransform.js | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 libs/single-spa-angular/webpack/webpack-5/styleTagTransform.js diff --git a/libs/single-spa-angular/src/single-spa-angular.ts b/libs/single-spa-angular/src/single-spa-angular.ts index 18ab73d..594f52c 100644 --- a/libs/single-spa-angular/src/single-spa-angular.ts +++ b/libs/single-spa-angular/src/single-spa-angular.ts @@ -74,6 +74,7 @@ async function bootstrap(options: BootstrappedSingleSpaAngularOptions): Promise< // is being executed or under which application, making it difficult to assert whether this // app is running under its zone. options.NgZone.assertInAngularZone = () => {}; + options.NgZone.assertNotInAngularZone = () => {}; options.routingEventListener = () => { options.bootstrappedNgZone!.run(() => { diff --git a/libs/single-spa-angular/webpack/webpack-5/remove-mini-css-extract.ts b/libs/single-spa-angular/webpack/webpack-5/remove-mini-css-extract.ts index 18ee3d5..b9ad7d3 100644 --- a/libs/single-spa-angular/webpack/webpack-5/remove-mini-css-extract.ts +++ b/libs/single-spa-angular/webpack/webpack-5/remove-mini-css-extract.ts @@ -66,7 +66,13 @@ function tryToRemoveMiniCssExtractThroughConditions(childRule: ChildRule): void ); if (cssMiniExtractIndex >= 0) { - childRuleCondition.use![cssMiniExtractIndex] = { loader: 'style-loader' }; + childRuleCondition.use![cssMiniExtractIndex] = { + loader: 'style-loader', + // @ts-ignore + options: { + styleTagTransform: require.resolve('./styleTagTransform.js'), + }, + }; } } } diff --git a/libs/single-spa-angular/webpack/webpack-5/styleTagTransform.js b/libs/single-spa-angular/webpack/webpack-5/styleTagTransform.js new file mode 100644 index 0000000..c850f95 --- /dev/null +++ b/libs/single-spa-angular/webpack/webpack-5/styleTagTransform.js @@ -0,0 +1,9 @@ +function styleTagTransform(css, style) { + console.trace(); + // eslint-disable-next-line no-param-reassign + style.innerHTML = `${css}.modify{}\n`; + + document.head.appendChild(style); +} + +module.exports = styleTagTransform;