Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Commit

Permalink
fix: #31
Browse files Browse the repository at this point in the history
- Plugin now properly gets the relative name (if it exists) of the file rather than just the name
- Skips replacing if the current dependent is not found
  • Loading branch information
samrith-s committed Mar 15, 2021
1 parent dbd77fc commit e507bb2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core/AssetMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class AssetMap extends ConfigProvider {
}

private iterativeDependencyResolver(depAsset: ParcelBundle): void {
const file = path.basename(depAsset.name);
const file = depAsset.entryAsset.relativeName || depAsset.name;
const extension = path.extname(file);
const mapFile = extension === '.map';
const fileConfig = (this.config.rules as Structurizer[]).find(c => {
Expand Down
4 changes: 1 addition & 3 deletions src/core/FileManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ export class FileManager extends ConfigProvider {

return dependents.reduce((newContent, dependent) => {
const thisDependent = this.assetsMap.get(dependent);

if (thisDependent.replacer) {
if (thisDependent?.replacer) {
newContent = newContent.replace(dependent, thisDependent.replacer);
}

Expand Down Expand Up @@ -107,7 +106,6 @@ export class FileManager extends ConfigProvider {

if (this.config.displayAssetsMap) {
logger.assetMap({ assetMap: this.assetsMap });
// logger.clearLine();
}

logger.complete({
Expand Down

0 comments on commit e507bb2

Please sign in to comment.