Skip to content

Commit

Permalink
fix(cmd-api-server): plugin imports via static config (env,cli,file)
Browse files Browse the repository at this point in the history
Depends on webpack/webpack#11316
This has no real effect until the PR above is
merged and releaed on Webpack
(and then we upgrade to that release for the builds)

How this fix works is explained in the linked PR
in greater detail.

Signed-off-by: Peter Somogyvari <[email protected]>
  • Loading branch information
petermetz committed Dec 1, 2020
1 parent 8734642 commit d7e550e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,16 @@ export class ApiServer {
const registry = new PluginRegistry({ plugins: [] });
const { logLevel } = this.options.config;
this.log.info(`Instantiated empty registry, invoking plugin factories...`);

for (const pluginImport of this.options.config.plugins) {
const { packageName, options } = pluginImport;
this.log.info(`Creating plugin from package: ${packageName}`, options);
const pluginOptions = { ...options, logLevel, pluginRegistry: registry };
const { createPluginFactory } = await import(packageName);

const {
createPluginFactory,
} = require(/* webpackIgnore: true */ packageName);

const pluginFactory: PluginFactory<
ICactusPlugin,
any
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
"removeComments": false, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
Expand Down

0 comments on commit d7e550e

Please sign in to comment.