Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/bs / dist / bundle / webpack.config.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
/**
 * @file build a production output of all of our bundles.
 * @see dist/dist/bundled
 */
const perf_hooks_1 = require("perf_hooks");
const resolveToRoot_1 = require("../resolveToRoot");
const getConfigForEnv_1 = tslib_1.__importDefault(require("../oneConfig/getConfigForEnv"));
const webpackConfigFactory_1 = require("./webpackConfigFactory");
const start = perf_hooks_1.performance.now();
// @note - this next require replaces `node scripts/shell/build_prod_pre &&`
// require('../.env').registerDotEnv()
try {
    require('../../shell/build_prod_pre');
}
catch (exception) {
    console.warn('cannot copy package.json to dist');
    console.error(exception);
    console.log('^ do not worry');
}
delete process.env.LOG_BUILD_PROGRESS;
// eslint-disable-next-line no-unused-vars
const [x, y, ...args] = process.argv;
const optimize = process.env.OPTIMIZE;
const ENV_INFRA = process.env.CI !== undefined;
const IS_PRODUCTION = process.env.NODE_ENV === 'production';
const bundles = getConfigForEnv_1.default('bundles');
const buildOutputPath = resolveToRoot_1.resolveToRoot(getConfigForEnv_1.default('buildOutputPath'));
const bundleNames = Object.keys(bundles);
// [client, server]
const configs = bundleNames
    .map(bundleName => {
    const webpackConfig = webpackConfigFactory_1.webpackConfigFactory({ target: bundleName, optimize });
    // webpack validates all keys, this will make it hidden
    Object.defineProperty(webpackConfig, 'named', {
        enumerable: false,
        value: bundleName,
    });
    return webpackConfig;
})
    .map(bundleConfig => {
    /**
     * @todo this works in webpack 4.5...
     * @see https://webpack.js.org/concepts/mode
     * @todo @fixme @perf @prod !!!!!!! THIS IS DISABLED BECAUSE THE TREE SHAKING IS MAKING SOME EXPORTS UNDEFINED
     */
    bundleConfig.mode = 'none';
    // bundleConfig.mode = 'production'
    // bundleConfig.mode = 'development'
    // so we can check the unminified output of server
    // if (bundleConfig.named === 'server') {
    //   bundleConfig.mode = 'development'
    // }
    return Object.assign({}, bundleConfig);
});
// for checking just server
// .filter((value, index) => {
//   // if (index === 1) return true
//   if (index === 0) return true
//   return false
// })
// console.log(configs.length)
// throw new Error(configs.length)
const end = perf_hooks_1.performance.now();
const diff = end - start;
console.log('[bs] config time: ', diff);
// require('fliplog').data(configs).bold('bundle configs:').echo()
exports.default = configs;
//# sourceMappingURL=webpack.config.js.map