Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
concatMap(config =>
// @ts-ignore
runWebpack(config, context, {
logging: stats => {
context.logger.info(stats.toString(config.stats));
},
}),
),
operators_1.concatMap(config =>
// @ts-ignore
build_webpack_1.runWebpack(config, context, {
logging: stats => {
context.logger.info(stats.toString(config.stats));
},
}),
),
(lastResult, config) => {
// Make sure to only run the 2nd build step, if 1st one succeeded
if (lastResult.success) {
return runWebpack(config, context, {
logging:
transforms.logging ||
(useBundleDownleveling
? () => {}
: createBrowserLoggingCallback(
!!options.verbose,
context.logger
))
});
} else {
return of();
}
},
{ success: true } as BuildResult,
concatMap(({ config, i18n }) => {
return runWebpack(config, context, {
webpackFactory: require('webpack') as typeof webpack,
}).pipe(
concatMap(async output => {
const { emittedFiles = [], webpackStats } = output;
if (!output.success || !i18n.shouldInline) {
return output;
}
if (!webpackStats) {
throw new Error('Webpack stats build result is required.');
}
outputPaths = ensureOutputPaths(baseOutputPath, i18n);
const success = await i18nInlineEmittedFiles(
context,
concatMap(config =>
runWebpack(config, context, {
logging: stats => {
context.logger.info(stats.toString(config.stats));
}
})
),
concatMap(config =>
runWebpack(config, context, {
logging: stats => {
context.logger.info(stats.toString(config.stats));
}
})
),
],
);
const logging: WebpackLoggingCallback = (stats, config) => {
const json = stats.toJson({ errors: true, warnings: true });
if (stats.hasWarnings()) {
context.logger.warn(statsWarningsToString(json, config.stats));
}
if (stats.hasErrors()) {
context.logger.error(statsErrorsToString(json, config.stats));
}
};
return runWebpack(config, context, {
logging,
webpackFactory: await import('webpack'),
}).toPromise();
}
(acc, config) => {
if (acc.success) {
return runWebpack(config, context, {
logging: stats => {
context.logger.info(stats.toString(config.stats));
}
});
} else {
return of();
}
},
{ success: true } as BuildResult,