Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const debug = (opts, label, ...additional) => {
if (!opts.debug) return
const prefix = `WebpackAdapter[${opts.ext}]`
const [, timingLabel, timingEvent] = label.match(/(.*):(start|end)$/) || []
if (timingLabel && timingEvent) {
const action = timingEvent === 'start' ? 'time' : 'timeEnd'
if (timingEvent === 'start') console.debug(yellow(`${prefix}.${timingLabel} -> start`), additional.join(['\n\n']))
console[action](yellow(`${prefix}.${timingLabel} -> end`))
} else {
console.debug(cyan(`${prefix}.${label}`), additional.join(['\n\n']))
}
}
const merge = webpackMerge.strategy({ entry: 'replace', output: 'replace' })
const buildConfig = options => {
const { serverConfig, serverRenderPath, clientConfig, clientRenderPath } = options
const config = {}
// deliberately skip optimizations
const mode = 'development'
// build webpack config by overriding entry and output
// and explicitely setting the target
if (serverConfig && serverRenderPath) {
config.server = merge(serverConfig, {
mode,
name: WEBPACK_NAME_SERVER,
target: 'node',
entry: {},
/**
* @author: @AngularClass
*/
const helpers = require('./helpers');
const webpackMerge = require('webpack-merge'); // used to merge webpack configs
const webpackMergeDll = webpackMerge.strategy({plugins: 'replace'});
const commonConfig = require('./webpack.common.js'); // the settings that are common to prod and dev
/**
* Webpack Plugins
*/
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
/**
* Webpack Constants
*/
const ENV = process.env.ENV = process.env.NODE_ENV = 'development';
const HOST = process.env.HOST || 'localhost';
const PORT = process.env.PORT || 8080;
/**
* @author: @AngularClass
*/
const helpers = require('./helpers');
const webpackMerge = require('webpack-merge'); // used to merge webpack configs
const webpackMergeDll = webpackMerge.strategy({plugins: 'replace'});
const commonConfig = require('./webpack.common.js'); // the settings that are common to prod and dev
/**
* Webpack Plugins
*/
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
/**
* Webpack Constants
*/
const ENV = process.env.ENV = process.env.NODE_ENV = 'DEV';
const HOST = process.env.HOST || 'localhost';
const PORT = process.env.PORT || 3000;
/**
* @author: @AngularClass
*/
const helpers = require('./helpers');
const webpackMerge = require('webpack-merge'); // used to merge webpack configs
const webpackMergeDll = webpackMerge.strategy({ plugins: 'replace' });
const commonConfig = require('./webpack.common.js'); // the settings that are common to prod and dev
/**
* Webpack Plugins
*/
const CopyWebpackPlugin = require('copy-webpack-plugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
/**
* Webpack Constants
*/
const ENV = process.env.ENV = process.env.NODE_ENV = 'development';
const HMR = helpers.hasProcessFlag('hot');
const METADATA = webpackMerge(commonConfig({ env: ENV }).metadata, {
ENV: ENV,
const helpers = require('./helpers');
const webpackMerge = require('webpack-merge'); //
const webpackMergeDll = webpackMerge.strategy({plugins: "replace"});
const commonConfig = require('./webpack.common.js');
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
const DllBundlesPlugin = require('webpack-dll-bundles-plugin').DllBundlesPlugin;
const ENV = process.env.ENV = process.env.NODE_ENV = 'development';
const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
host: 'localhost',
port: 9051,
ENV: ENV,
});
updateClientConfig(cfg = {}) {
let strategy = {};
if (cfg.entry && cfg.entry.length > 0) {
strategy.entry = "replace";
}
this.clientConfig = webpackMerge.strategy(strategy)(this.clientConfig, cfg);
}
const merge = require('webpack-merge');
module.exports = merge.strategy(
{
'module.rules': 'append',
plugins: 'append',
},
);
async updateClientConfigWithStrategy(strategy = {}, config = {}) {
if (!typeof strategy === "object" || !typeof config === "object") {
this.parent.logger.warn(
"[Webpack] updateClientConfigWithStrategy(strategy, object) - You must pass a object"
);
}
this.clientConfig = webpackMerge.strategy(strategy)(
this.clientConfig,
config
);
}