Reputation: 11
For angular webpack based builders, how to config the define
for tree sharking or compress in the built-in javaScriptOptimizerPlugin ?
async function optimizeWithEsbuild(content, name, options) {
if (!esbuild) {
esbuild = new esbuild_executor_1.EsbuildExecutor(options.alwaysUseWasm);
}
try {
return await esbuild.transform(content, {
minifyIdentifiers: !options.keepIdentifierNames,
minifySyntax: true,
// NOTE: Disabling whitespace ensures unused pure annotations are kept
minifyWhitespace: false,
pure: ['forwardRef'],
legalComments: options.removeLicenses ? 'none' : 'inline',
sourcefile: name,
sourcemap: options.sourcemap && 'external',
define: options.define,
target: options.target,
});
}
catch (error) {
if (isEsBuildFailure(error)) {
return error;
}
throw error;
}
}
I want to know the entry point to config the defined property and so on. And does angular allow us to config the tree sharking here?
Upvotes: 1
Views: 26