Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/tall-mice-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@atlaspack/packager-js': patch
---

Add the 'asset-file-names-in-output' debug tool to the DevPackager
16 changes: 13 additions & 3 deletions packages/packagers/js/src/DevPackager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
relativeBundlePath,
countLines,
normalizeSeparators,
debugTools,
} from '@atlaspack/utils';
import SourceMap from '@parcel/source-map';
import {getFeatureFlag} from '@atlaspack/feature-flags';
Expand Down Expand Up @@ -127,11 +128,20 @@ export class DevPackager {

let {code, mapBuffer} = results[i];
let output = code || '';

wrapped +=
JSON.stringify(this.bundleGraph.getAssetPublicId(asset)) +
':[function(require,module,exports,__globalThis) {\n' +
output +
'\n},';
':[function(require,module,exports,__globalThis) {\n';

if (debugTools['asset-file-names-in-output']) {
let assetPath = path.relative(
this.options.projectRoot,
asset.filePath,
);
wrapped += `/* ${assetPath} */\n`;
Copy link
Contributor

@mattcompiles mattcompiles Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Account for source maps

}

wrapped += output + '\n},';
wrapped += JSON.stringify(deps);
wrapped += ']';

Expand Down
Loading