mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
const webpackMerge = require('webpack-merge');
|
|
const commonPartial = require('./webpack/webpack.common');
|
|
const clientPartial = require('./webpack/webpack.client');
|
|
const serverPartial = require('./webpack/webpack.server');
|
|
const prodPartial = require('./webpack/webpack.prod');
|
|
|
|
const {
|
|
getAotPlugin
|
|
} = require('./webpack/webpack.aot');
|
|
|
|
const {
|
|
root
|
|
} = require('./webpack/helpers');
|
|
|
|
module.exports = function(options, webpackOptions) {
|
|
options = options || {};
|
|
|
|
if (options.aot) {
|
|
console.log(`Running build for ${options.client ? 'client' : 'server'} with AoT Compilation`)
|
|
}
|
|
|
|
let serverConfig = webpackMerge({}, commonPartial, serverPartial, {
|
|
plugins: [
|
|
getAotPlugin('server', !!options.aot)
|
|
]
|
|
});
|
|
|
|
let clientConfig = webpackMerge({}, commonPartial, clientPartial, {
|
|
plugins: [
|
|
getAotPlugin('client', !!options.aot)
|
|
]
|
|
});
|
|
|
|
if (webpackOptions.p) {
|
|
serverConfig = webpackMerge({}, serverConfig, prodPartial);
|
|
clientConfig = webpackMerge({}, clientConfig, prodPartial);
|
|
}
|
|
|
|
const configs = [];
|
|
|
|
if (!options.aot) {
|
|
configs.push(clientConfig, serverConfig);
|
|
} else if (options.client) {
|
|
configs.push(clientConfig);
|
|
} else if (options.server) {
|
|
configs.push(serverConfig);
|
|
}
|
|
|
|
return configs;
|
|
}
|