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

Can't replace scullySystem plugins in config file #1636

Open
gregorymaertens opened this issue Jan 2, 2023 · 0 comments
Open

Can't replace scullySystem plugins in config file #1636

gregorymaertens opened this issue Jan 2, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@gregorymaertens
Copy link

🐞 Bug report

Description

I was trying to write my own WriteToStorage plugin, but it was never called.
Investigating the issue I have found out the reason for it:
in /src/lib/utils/handlers/renderParallel.ts the plugin is fetched while executing the following static code:
const writeToFs = findPlugin(WriteToStorage);

That's done before the configuration is compiled and executed, as a result any attempt to replace the plugin won't have any effect.

A simple fix for this would be to fetch the plugin only when needed it:


let writeToFs;

const reThrow = (e) => {
  throw new Error(e);
};
let executePluginsForRoute;

export async function renderParallel(dataRoutes: any[]): Promise {
  writeToFs = writeToFs || findPlugin(WriteToStorage); // defer init of writeToFs till it's needed and avoid calling findPlugin() all the time
executePluginsForRoute = executePluginsForRoute  || findPlugin(renderRoute);
...

NOTE:

🔬 Minimal Reproduction

add a

💻Your Environment

Angular Version:



Angular CLI: 13.3.10
Node: 16.14.2
Package Manager: npm 8.5.0
OS: darwin x64

Angular: 13.3.12
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1303.10
@angular-devkit/build-angular   13.3.10
@angular-devkit/core            13.3.10
@angular-devkit/schematics      13.3.10
@angular/cdk                    13.3.9
@angular/cli                    13.3.10
@angular/material               13.3.9
@schematics/angular             13.3.10
rxjs                            7.8.0
typescript                      4.6.4

Scully Version:


  "@scullyio/init": "^2.1.41",
    "@scullyio/ng-lib": "^2.1.0",
    "@scullyio/scully": "^2.1.0",
    "@scullyio/scully-plugin-puppeteer": "^2.1.0",


🔥 Exception or Error




@gregorymaertens gregorymaertens added the bug Something isn't working label Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant