Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix writing files in subfolders inside dist directory #1097

Merged
merged 14 commits into from
Apr 4, 2018

Conversation

Ty3uK
Copy link
Contributor

@Ty3uK Ty3uK commented Mar 29, 2018

Related to #1096. If static files placed in subfolders, parcel throws error in fs.writeFile because those subfolders doesn't created inside dist.

@Ty3uK
Copy link
Contributor Author

Ty3uK commented Mar 29, 2018

Sorry for trash commits, merging upstream gives me conflicts 😖

@@ -12,6 +13,12 @@ class RawPackager extends Packager {
contents = await fs.readFile(contents ? contents.path : asset.name);
}

// Create output path if not exist
const dir = path.dirname(this.bundle.name);
if (!await fs.exists(dir)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can directly do fs.mkdirp, mkdirp will internally check if the directory exists. It will save a few I/O calls

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'll fix that ASAP

yarn.lock Outdated
@@ -6628,6 +6628,8 @@ void-elements@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec"

<<<<<<< HEAD
Copy link
Member

Choose a reason for hiding this comment

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

looks like merge issue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@devongovett my bad :(

@devongovett
Copy link
Member

Updated slightly to ignore the mkdirp call if there are no path separators in the output filename. Should be slightly faster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants