infrastructure-components
Version:
Infrastructure-Components configure the infrastructure of your React-App as part of your React-Components.
36 lines • 1.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const webapp_component_1 = require("./webapp-component");
/**
* A Plugin to detect WebApp-Components
* @param props
*/
exports.WebAppPlugin = (props) => {
const path = require('path');
const result = {
// identify Isomorphic-App-Components
applies: (component) => {
return webapp_component_1.isWebApp(component);
},
// convert the component into configuration parts
// while the component is of Type `any`, its props must be of type `IWebApp`
process: (component, childConfigs, infrastructureMode) => {
return {
slsConfigs: [],
// a webapp has its own webpack configuration
webpackConfigs: [
require("../../../infrastructure-scripts/dist/infra-comp-utils/webpack-libs").complementWebpackConfig(require("../../../infrastructure-scripts/dist/infra-comp-utils/webpack-libs").createClientWebpackConfig("./" + path.join("node_modules", "infrastructure-components", "dist", "assets", "client.js"), //entryPath: string,
path.join(require("../../../infrastructure-scripts/dist/infra-comp-utils/system-libs").currentAbsolutePath(), props.buildPath), //use the buildpath from the parent plugin
component.id, {
__CONFIG_FILE_PATH__: require("../../../infrastructure-scripts/dist/infra-comp-utils/system-libs").pathToConfigFile(props.configFilePath),
}, {
__ISOMORPHIC_ID__: `"${component.instanceId}"`,
}))
],
postBuilds: [],
};
}
};
return result;
};
//# sourceMappingURL=webapp-plugin.js.map