Skip to content
Closed
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions packages/core/src/plugins/EntryChunkPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class EntryChunkPlugin {

apply(compiler: Rspack.Compiler) {
compiler.hooks.entryOption.tap(PLUGIN_NAME, (_context, entries) => {
console.time('entryOption');
for (const name in entries) {
const entry = (entries as Rspack.EntryStaticNormalized)[name];
if (!entry) continue;
Expand Down Expand Up @@ -85,9 +86,11 @@ class EntryChunkPlugin {
this.reactDirectives[name] = reactDirective;
}
}
console.timeEnd('entryOption');
});

compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
console.time('chunkAsset');
compilation.hooks.chunkAsset.tap(PLUGIN_NAME, (chunk, filename) => {
const isJs = JS_EXTENSIONS_PATTERN.test(filename);
if (!isJs) return;
Expand All @@ -105,9 +108,11 @@ class EntryChunkPlugin {
this.reactDirectives[filename] = reactDirective;
}
});
console.timeEnd('chunkAsset');
});

compiler.hooks.make.tap(PLUGIN_NAME, (compilation) => {
console.time('processAssets');
compilation.hooks.processAssets.tap(PLUGIN_NAME, (assets) => {
if (!this.enabledImportMetaUrlShim) return;

Expand Down Expand Up @@ -168,12 +173,15 @@ class EntryChunkPlugin {
}
},
);
console.timeEnd('processAssets');
});

compiler.hooks.assetEmitted.tap(PLUGIN_NAME, (file, { targetPath }) => {
console.time('assetEmitted');
if (this.shebangInjectedAssets.has(file)) {
chmodSync(targetPath, this.shebangChmod);
}
console.timeEnd('assetEmitted');
});
}
}
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/plugins/entryModuleLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function splitFromFirstLine(text: string): [string, string] {
}

const loader: Rspack.LoaderDefinition = function loader(source) {
console.time('entryModuleLoader');
let result = source;

if (this.resourceQuery === `?${RSLIB_ENTRY_QUERY}`) {
Expand All @@ -30,6 +31,8 @@ const loader: Rspack.LoaderDefinition = function loader(source) {
}
}

console.timeEnd('entryModuleLoader');

return result;
};

Expand Down
Loading