const shell = require('shelljs');

const angularExternals = {
    "@angular/core": "ng.core",
    "@angular/common": "ng.common",
    "@angular/common/http": "ng.common.http",
    "@angular/platform-browser": "ng.platformBrowser",
    "@angular/platform-browser-dynamic": "ng.platformBrowserDynamic",
    "@angular/elements": "ng.elements",
    "@angular/compiler": "ng.compiler",
    "@angular/animations": "ng.animations",
    "@angular/forms": "ng.forms",
    "@angular/http": "ng.http",
    "@angular/router": "ng.router",
};

const maggioliExternals = {
    "@maggioli/cmn-ng": "maggioli.cmnNg",
    "@maggioli/ctl-dt": "maggioli.ctlDt",
    "@maggioli/grd-dt": "maggioli.grdDt",
}

const othersExternal = {
    "zone": "zone",
    "rxjs": "rxjs",
    'rxjs/operators': 'rxjs.operators',
    "jquery": "jquery",
    "lodash": "lodash",
    "moment": "moment",
}

const externals =
{
    ...angularExternals,
    ...maggioliExternals,
    ...othersExternal
}

const output = { jsonpFunction: 'maggioli_sicraweb_pro' }

module.exports = {
    output,
    mode: 'production',
    externals,
    module: { noParse: (content) => /jquery|lodash|moment/.test(content) },
    optimization: {
        minimize: false
    }
}