Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function evaluate({
rootPath, actions, formats, presets, webpackrc, target
}, ...config) {
actions = actions || noop;
formats = formats || noop;
presets = presets || noop;
const rcConfiguration = merge.apply(null, [webpackrc].concat(
parse(apply(presets, paths), webpackrc.presets))
);
const parsedEnv = rcConfiguration.env[target] || {};
const commonConfig = rcConfiguration.common ?
rcConfiguration.common[target.split(':')[0]] || {} :
{};
const paths = resolvePaths(
rootPath,
Object.assign({}, rcConfiguration.paths, commonConfig.paths, parsedEnv.paths)
);
const evaluatedActions = apply(actions, paths);
const evaluatedFormats = apply(formats, paths);
const rootConfig = {
resolve: {
extensions: ['']
}
rootPath,
Object.assign({}, rcConfiguration.paths, commonConfig.paths, parsedEnv.paths)
);
const evaluatedActions = apply(actions, paths);
const evaluatedFormats = apply(formats, paths);
const rootConfig = {
resolve: {
extensions: ['']
}
};
const parsedRootActions = parse(evaluatedActions, rcConfiguration.actions);
const parsedActions = parse(evaluatedActions, parsedEnv.actions);
const parsedRootFormats = parse(evaluatedFormats, rcConfiguration.formats);
const parsedFormats = parse(evaluatedFormats, parsedEnv.formats);
return merge.apply(null, [rootConfig, commonConfig].
concat(parsedRootActions).concat(parsedRootFormats).concat([
parsedEnv
]).concat(config).concat(parsedActions).concat(parsedFormats));
}
module.exports = (type, typeConfig) => {
const configs = [getCommonConfig(type), typeConfig];
const customConfigPath = webpackUtils.rootPath('configs', `webpack.${ type }.js`);
if (fs.existsSync(customConfigPath)) {
let customConfig = require(customConfigPath);
if (Object.prototype.toString.call(customConfig) === '[object Function]') {
customConfig = customConfig();
}
configs.push(customConfig);
}
return webpackMerge.apply(null, configs);
};
function apply(configuration, paths) {
if (Array.isArray(configuration)) {
return merge.apply(null, configuration.map((conf) => conf(paths)));
}
return configuration(paths);
}
require('./webpack.config.pictures'),
require('./webpack.config.vendors'),
require('./webpack.config.manifest'),
require('./webpack.config.progress'),
addAnalyzer ? require('./webpack.config.analyzer') : null,
require('./webpack.config.services'),
require(`./webpack.target.${target}`)
]
if (environment === 'production') {
configs.push(require('./webpack.environment.prod'))
} else {
configs.push(require('./webpack.environment.dev'))
}
module.exports = merge.apply(null, configs)
require('./webpack.config.pictures'),
require('./webpack.config.vendors'),
require('./webpack.config.manifest'),
require('./webpack.config.progress'),
addAnalyzer ? require('./webpack.config.analyzer') : null,
require('./webpack.config.services'),
require(`./webpack.target.${target}`)
]
if (environment === 'production') {
configs.push(require('./webpack.environment.prod'))
} else {
configs.push(require('./webpack.environment.dev'))
}
module.exports = merge.apply(null, configs)
require('./webpack.config.pictures'),
require('./webpack.config.assets'),
require('./webpack.config.manifest'),
require('./webpack.config.progress'),
addAnalyzer ? require('./webpack.config.analyzer') : null,
require('./webpack.config.services'),
require(`./webpack.target.${target}`)
]
if (environment === 'production') {
configs.push(require('./webpack.environment.prod'))
} else {
configs.push(require('./webpack.environment.dev'))
}
module.exports = merge.apply(null, configs)