Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}) {
const emitter = new EventEmitter();
const { configPath, configOptions } = JSON.parse(options);
const runtime = new Runtime();
runtime.logger.proxy((level, ...args) => {
setImmediate(() => {
emitter.emit(Events.LOG, {
message: runtime.logger.stringify(args).join(' '),
level,
});
});
});
const outputPath = configOptions.assetsDest;
const projectConfig = getNormalizedProjectConfigBuilder(runtime, configPath)(
runtime,
{
...configOptions,
platform,
}
);
const apps = [];
const bundles = sortBundlesByDependencies(projectConfig);
let totalProgress = 0;
let bundlesBuilt = 0;
for (const bundleName of bundles) {
const bundleConfig = projectConfig.bundles[bundleName];
if (bundleConfig.external) {
const bundleFilename = getBundleFilename(
config,
dev,
minify,
platform,
assetsDest,
bundleOutput,
sourcemapOutput,
progress,
skipHostCheck,
} = argv;
process.env.HAUL_PLATFORM = platform;
const directory = process.cwd();
const configPath = getProjectConfigPath(directory, config);
const normalizedProjectConfigBuilder = getNormalizedProjectConfigBuilder(
runtime,
configPath
);
const env: EnvOptions = {
platform,
root: directory,
dev,
bundleMode: 'multi-bundle',
bundleTarget: 'file',
bundleOutput,
assetsDest,
sourcemapOutput,
minify: minify === undefined ? !dev : minify,
};
const projectConfig = normalizedProjectConfigBuilder(runtime, env);
parsedEager = list;
}
const directory = process.cwd();
let tempDir: string;
if (argv.tempDir) {
tempDir = path.isAbsolute(argv.tempDir)
? argv.tempDir
: path.join(directory, argv.tempDir);
} else {
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'haul-start-'));
}
const configPath = getProjectConfigPath(directory, argv.config);
const projectConfig = getNormalizedProjectConfigBuilder(
runtime,
configPath
)(runtime, {
platform: '',
root: directory,
dev: argv.dev,
port: argv.port,
bundleMode: 'multi-bundle',
bundleTarget: 'server',
assetsDest: tempDir,
minify: argv.minify === undefined ? !argv.dev : argv.minify,
});
try {
const isTaken = await isPortTaken(
projectConfig.server.port,
export default function prepareWebpackConfig(
runtime: Runtime,
options: Options
): webpack.Configuration {
const directory = process.cwd();
const configPath = getProjectConfigPath(directory, options.config);
const normalizedProjectConfigBuilder = getNormalizedProjectConfigBuilder(
runtime,
configPath
);
const projectConfig = normalizedProjectConfigBuilder(runtime, {
platform: options.platform,
root: directory,
dev: options.dev,
bundleType: options.bundleType,
bundleMode: options.bundleMode,
bundleTarget: 'file',
assetsDest: options.assetsDest,
bundleOutput: options.bundleOutput,
sourcemapOutput: options.sourcemapOutput,
minify: options.minify === undefined ? !options.dev : options.minify,
});