UNPKG

@pega/constellation-dx-components-build-utils

Version:

This tool uses a 'v3' approach to group components in a library, create a component map, employ webpack, and load the library like Pega-generated components, constellation app-static.

21 lines (19 loc) 570 B
class DynamicFetchScriptHookPlugin { constructor(v3) { this.v3 = v3; } apply(compiler) { compiler.hooks.compilation.tap( "DynamicFetchScriptHookPlugin", (compilation) => compilation.mainTemplate.hooks.jsonpScript.tap( "DynamicFetchScriptHookPlugin", (source) => [ source, "if (typeof dynamicFetchScriptHook === 'function') {", " script = dynamicFetchScriptHook(script, "+this.v3+");", "}" ].join("\n") ) ); } } module.exports = DynamicFetchScriptHookPlugin;