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:
- Created 4 years ago
- Reactions:17
- Comments:19 (9 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
this is going to be implemented? I guess this is basic functionality, lib should provide, --clean-before-build or --clean flag can be implemented
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: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.