/** * Creates the webpack config * @param {Gasket} gasket The Gasket API * @param {Object} webpackConfig Initial webpack config * @param {Object} data Additional info * @returns {Object} Final webpack config */ function initWebpack(gasket, webpackConfig, data) { const { execSync, config } = gasket; const chain = new WebpackChain(); execSync('webpackChain', chain, data); // // Merge defaults with gasket.config webpack. // webpackConfig = webpackMerge.smart( webpackConfig, { plugins: [new WebpackMetricsPlugin({ gasket })] }, webpackDefaults, // Defaults above chain.toConfig(), // Webpack chain from plugins (partial) config.webpack || {} // Webpack config from user (partial) ); const configs = execSync('webpack', webpackConfig, data).filter(Boolean); return webpackMerge.smart(webpackConfig, ...configs); }
/** * Creates the webpack config * @param {Gasket} gasket The Gasket API * @param {Object} webpackConfig Initial webpack config * @param {Object} data Additional info * @returns {Object} Final webpack config */ function initWebpack(gasket, webpackConfig, data) { const { execSync, config } = gasket; const chain = new WebpackChain(); execSync('webpackChain', chain, data); // // Merge defaults with gasket.config webpack. // webpackConfig = webpackMerge.smart( webpackConfig, { plugins: [new WebpackMetricsPlugin({ gasket })] }, webpackDefaults, // Defaults above chain.toConfig(), // Webpack chain from plugins (partial) config.webpack || {} // Webpack config from user (partial) ); const configs = execSync('webpack', webpackConfig, data).filter(Boolean); return webpackMerge.smart(webpackConfig, ...configs); }