Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
...context,
builder: {
...context.builder,
builderName: 'browser',
},
},
host,
true,
);
const config = await applyWebpackPartialConfig(
browserConfig,
universalOptions.partialBrowserConfig as string,
);
const tsConfig = readTsconfig(browserOptions.tsConfig, context.workspaceRoot);
const target = tsConfig.options.target || ScriptTarget.ES5;
const buildBrowserFeatures = new BuildBrowserFeatures(projectRoot, target);
const isDifferentialLoadingNeeded = buildBrowserFeatures.isDifferentialLoadingNeeded();
const useBundleDownleveling = isDifferentialLoadingNeeded && !browserOptions.watch;
if (target > ScriptTarget.ES2015 && isDifferentialLoadingNeeded) {
context.logger.warn(tags.stripIndent`
WARNING: Using differential loading with targets ES5 and ES2016 or higher may
cause problems. Browsers with support for ES2015 will load the ES2016+ scripts
referenced with script[type="module"] but they may not support ES2016+ syntax.
`);
}
if (browserOptions.deleteOutputPath) {
deleteOutputDir(
context.workspaceRoot,
buildWebpackConfig(
root: Path,
projectRoot: Path,
host: virtualFs.Host,
options: NormalizedBrowserBuilderSchema,
) {
let wco: WebpackConfigOptions;
const tsConfigPath = getSystemPath(normalize(resolve(root, normalize(options.tsConfig))));
const tsConfig = readTsconfig(tsConfigPath);
const projectTs = requireProjectModule(getSystemPath(projectRoot), 'typescript') as typeof ts;
const supportES2015 = tsConfig.options.target !== projectTs.ScriptTarget.ES3
&& tsConfig.options.target !== projectTs.ScriptTarget.ES5;
wco = {
root: getSystemPath(root),
projectRoot: getSystemPath(projectRoot),
buildOptions: options,
tsConfig,
tsConfigPath,
supportES2015,
};
const webpackConfigs: {}[] = [
getServerConfig(wco),
getStylesConfig(wco),
getStatsConfig(wco),
getAotConfig(wco),
],
);
setWebpackServerFileLoaderEmitFile(universalOptions, serverOptions, browserOptions, serverConfig);
setWebpackServerExternals(universalOptions, serverConfig);
const config = await applyWebpackPartialConfig(
serverConfig,
universalOptions.partialServerConfig as string,
);
const tsConfig = readTsconfig(serverOptions.tsConfig, context.workspaceRoot);
const target = tsConfig.options.target || ScriptTarget.ES5;
if (serverOptions.deleteOutputPath) {
deleteOutputDir(
context.workspaceRoot,
serverOptions.outputPath,
);
}
return {
options: serverOptions,
config,
projectRoot,
projectSourceRoot,
i18n,
target,