Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function webpackConfigFactory(args: any): webpack.Configuration {
tsnode.register({ transpileOnly: true });
const isLegacy = args.legacy;
const experimental = args.experimental || {};
const isExperimentalSpeed = !!experimental.speed && args.mode === 'dev' && !isLegacy;
const isTest = args.mode === 'unit' || args.mode === 'functional' || args.mode === 'test';
const singleBundle = args.singleBundle || isTest || isExperimentalSpeed;
const watch = args.watch;
const extensions = isLegacy ? ['.ts', '.tsx', '.js'] : ['.ts', '.tsx', '.mjs', '.js'];
const compilerOptions = isLegacy ? {} : { target: 'es2017', module: 'esnext', downlevelIteration: false };
let features = isLegacy ? args.features : { ...(args.features || {}), ...getFeatures('modern') };
features = { ...features, 'dojo-debug': false };
const staticOnly = [];
const assetsDir = path.join(process.cwd(), 'assets');
const assetsDirPattern = new RegExp(assetsDir);
const lazyModules = Object.keys(args.bundles || {}).reduce(
(lazy, key) => {
lazy.push(...args.bundles[key]);
return lazy;
},
[] as string[]
);
const watchExtraFiles = Array.isArray(args.watchExtraFiles) ? args.watchExtraFiles : [];
let entry: any;
if (!isTest) {
features = { ...features, test: false };
}