question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flag to delete output folder before building

See original GitHub issue

🙋 Feature request

A flag/option to delete the output folder before building.

It’s common place to do that in order to avoid mixing dev asssets and production assets.

🤔 Expected Behavior

Simply remove the output destination recursively before building via a flag Should be enabled by default.

😯 Current Behavior

It has to be scripted manually.

💁 Possible Solution

Per-target flag/option deleteBeforeBuild which is enabled by default in production build mode. Simply removes the output folder.

🔦 Context

Most people add rm -rf dist; before the parcel command

That’s bad for windows users since rm doesn’t work that way there

Having it in parcel would make things a lot easier and save the hassle of manually adding the recursive rm command

💻 Examples

$ npx parcel build index.html -o dist --delete-before-build
{
  "target": {
    "browser": {
      "main": "index.html",
      "deleteBeforeBuild": true
    }
  }
}

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:17
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

10reactions
ermarkarcommented, Apr 9, 2020

this is going to be implemented? I guess this is basic functionality, lib should provide, --clean-before-build or --clean flag can be implemented

6reactions
devongovettcommented, Oct 8, 2019

Also unlike Parcel 1, Parcel 2 can output files wherever you want (not necessarily into a dist directory). For example, you could have this in your package.json:

{
  "name": "my-package",
  "source": "src/index.js",
  "main": "index.js"
}

In that example, the dist directory is actually the main package dir with all your source code too. You wouldn’t want to delete that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Where to specify delete-output-path? - angular - Stack Overflow
I understand there is a delete-output-path parameter that can be put on the command line to ng build .
Read more >
Remove Directory in Linux – How to Delete a Folder from the ...
Some important flags you'll need to use when deleting a directory are as follows: -r , -R , --recursive ["Recursion"] – Removes directories...
Read more >
Delete Files Action - Visual Build Help
The Delete Files action creates a step to delete files and folders. It supports processing of subdirectories, including and excluding files and folders...
Read more >
Output Directory Layout - Bazel
You can use Bazel's --output_base startup option to override the default output base directory. For example, bazel --output_base=/tmp/bazel/output build x/y:z .
Read more >
Output Management - webpack
In general it's good practice to clean the /dist folder before each build, so that only used files will be generated. Let's take...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found