mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* chore(NA): fix-env-prod-for-dll. * refact(NA): changed the condition to generate dll accordingly an env.
This commit is contained in:
parent
d8c3723505
commit
d2e0b26f68
2 changed files with 15 additions and 13 deletions
|
@ -32,10 +32,9 @@ const existsAsync = promisify(fs.exists);
|
|||
const writeFileAsync = promisify(fs.writeFile);
|
||||
|
||||
export class DllCompiler {
|
||||
static getRawDllConfig(alias = {}, noParseRules = []) {
|
||||
static getRawDllConfig(uiBundles = {}) {
|
||||
return {
|
||||
alias,
|
||||
noParseRules,
|
||||
uiBundles,
|
||||
context: fromRoot('.'),
|
||||
entryName: 'vendors',
|
||||
dllName: '[name]',
|
||||
|
@ -52,8 +51,7 @@ export class DllCompiler {
|
|||
|
||||
constructor(uiBundles, log) {
|
||||
this.rawDllConfig = DllCompiler.getRawDllConfig(
|
||||
uiBundles.getAliases(),
|
||||
uiBundles.getWebpackNoParseRules()
|
||||
uiBundles
|
||||
);
|
||||
this.log = log || (() => null);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { fromRoot, IS_KIBANA_DISTRIBUTABLE } from '../../utils';
|
||||
import { fromRoot } from '../../utils';
|
||||
import webpack from 'webpack';
|
||||
import webpackMerge from 'webpack-merge';
|
||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||
|
@ -131,8 +131,9 @@ function generateDLL(config) {
|
|||
|
||||
function extendRawConfig(rawConfig) {
|
||||
// Build all extended configs from raw config
|
||||
const dllAlias = rawConfig.alias;
|
||||
const dllNoParseRules = rawConfig.noParseRules;
|
||||
const dllAlias = rawConfig.uiBundles.getAliases();
|
||||
const dllNoParseRules = rawConfig.uiBundles.getWebpackNoParseRules();
|
||||
const dllDevMode = rawConfig.uiBundles.isDevMode();
|
||||
const dllContext = rawConfig.context;
|
||||
const dllEntry = {};
|
||||
const dllEntryName = rawConfig.entryName;
|
||||
|
@ -158,6 +159,7 @@ function extendRawConfig(rawConfig) {
|
|||
return {
|
||||
dllAlias,
|
||||
dllNoParseRules,
|
||||
dllDevMode,
|
||||
dllContext,
|
||||
dllEntry,
|
||||
dllOutputPath,
|
||||
|
@ -169,9 +171,9 @@ function extendRawConfig(rawConfig) {
|
|||
};
|
||||
}
|
||||
|
||||
function common(rawConfig) {
|
||||
function common(config) {
|
||||
return webpackMerge(
|
||||
generateDLL(extendRawConfig(rawConfig))
|
||||
generateDLL(config)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -234,9 +236,11 @@ function unoptimized() {
|
|||
}
|
||||
|
||||
export function configModel(rawConfig = {}) {
|
||||
if (IS_KIBANA_DISTRIBUTABLE) {
|
||||
return webpackMerge(common(rawConfig), optimized());
|
||||
const config = extendRawConfig(rawConfig);
|
||||
|
||||
if (config.dllDevMode) {
|
||||
return webpackMerge(common(config), unoptimized());
|
||||
}
|
||||
|
||||
return webpackMerge(common(rawConfig), unoptimized());
|
||||
return webpackMerge(common(config), optimized());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue