@atlassian/wrm-troubleshooting
Version:
A tool that can help you with troubleshooting the configuration of webpack and Atlassian P2 project.
22 lines • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getWrmWebpackPlugin = void 0;
const webpackWrmPlugin_1 = require("../webpackWrmPlugin");
const types_1 = require("./types");
const missingPluginError = new Error(`Provided webpack configuration is not using "${webpackWrmPlugin_1.NPM_PACKAGE_NAME}" webpack plugin.`);
const getWrmWebpackPlugin = async (options, payload) => {
const { webpackEffectiveConfig } = payload;
const { plugins } = webpackEffectiveConfig;
if (!Array.isArray(plugins)) {
return (0, types_1.getFailedResult)(missingPluginError);
}
const wrmWebpackPlugin = plugins.find((plugin) => plugin.pluginName === webpackWrmPlugin_1.WRM_PLUGIN_NAME);
if (!wrmWebpackPlugin) {
return (0, types_1.getFailedResult)(missingPluginError);
}
return (0, types_1.getPassedResult)({
wrmWebpackPlugin: wrmWebpackPlugin,
});
};
exports.getWrmWebpackPlugin = getWrmWebpackPlugin;
//# sourceMappingURL=getWrmWebpackPlugin.js.map