Skip to content

Commit

Permalink
unix style dir separators also for absolute urls
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Lonsing committed Mar 15, 2019
1 parent 0b4503b commit 3c9f776
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/core/parcel-bundler/src/Asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,10 @@ class Asset {
// Replace temporary bundle names in the output with the final content-hashed names.
let newValue = value;
for (let [name, map] of bundleNameMap) {
newValue = newValue
.split(name)
.join(this.makeBundlePathRelativeToParentBundle(map));
const newBundlePath = this.convertToUnixStyleDirectorySeparators(
this.makeBundlePathRelativeToParentBundle(map)
);
newValue = newValue.split(name).join(newBundlePath);
}

// Copy `this.generated` on write so we don't end up writing the final names to the cache.
Expand Down Expand Up @@ -290,12 +291,17 @@ class Asset {
const parentBundleRelativePath = this.parentBundle.getHashedBundleName();
const parentBundleRelativeDir =
path.dirname(parentBundleRelativePath) || '.';
const relativeBundlePath = path
.relative(parentBundleRelativeDir, bundlePath)
.replace('\\', '/');
const relativeBundlePath = path.relative(
parentBundleRelativeDir,
bundlePath
);
return relativeBundlePath;
}

convertToUnixStyleDirectorySeparators(bundlePath) {
return bundlePath.replace('\\', '/');
}

generateErrorMessage(err) {
return err;
}
Expand Down

0 comments on commit 3c9f776

Please sign in to comment.