Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -483,19 +483,28 @@ export function createCompilerPlugin(
build.onLoad(
{ filter: /\.[cm]?js$/ },
createCachedLoad(pluginOptions.loadResultCache, async (args) => {
let request = args.path;
if (pluginOptions.fileReplacements) {
const replacement = pluginOptions.fileReplacements[path.normalize(args.path)];
if (replacement) {
request = path.normalize(replacement);
}
}

return profileAsync(
'NG_EMIT_JS*',
async () => {
const sideEffects = await hasSideEffects(args.path);
const sideEffects = await hasSideEffects(request);
const contents = await javascriptTransformer.transformFile(
args.path,
request,
pluginOptions.jit,
sideEffects,
);

return {
contents,
loader: 'js',
watchFiles: request !== args.path ? [request] : undefined,
};
},
true,
Expand Down