Parcel2 build command outputs bundles in my src folder instead of dist folder.
See original GitHub issue🐛 Parcel2 build command outputs bundles in my src folder instead of dist folder.
When I run the parcel build ./src/index.html --dist-dir ./dist the bundle will get outputted to my src directory instead of the dist directory. Running parcel serve ./src/index.html works as expected.
🎛 Configuration (.babelrc, package.json, cli command)
{
"name": "my app",
"version": "1.0.0",
"description": "This is a app",
"main": "src/index.html",
"scripts": {
"start": "parcel serve ./src/index.html",
"build": "parcel build ./src/index.html --dist-dir ./dist",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Andrew",
"license": "ISC",
"alias": {
"components": "./src/components",
"containers": "./src/containers",
"style": "./src/style",
"assets": "./src/assets",
"libs": "./src/libs",
"workers": "./src/workers",
"db": "./src/db"
},
"devDependencies": {
"parcel": "next",
"sass": "^1.26.11"
},
"dependencies": {
"bulma": "^0.9.1",
"lunr": "^2.3.9",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.2.0"
}
}
🤔 Expected Behavior
It should build to ./dist even without the additional flag.
😯 Current Behavior
Throws all bundle files and replaces my index.html with the bundle version.
🔦 Context
I’m building a very basic app using React to try out Parcel v2. I never experienced this issue using Parcel v1. Was really hoping to migrate the team to v2. 😢
💻 Code Sample
N/A
🌍 Your Environment
Arch Linux 64x
| Software | Version(s) |
|---|---|
| Parcel | 2.0.0-beta.1 |
| Node | v12.19.0 |
| npm/Yarn | 6.14.7/1.22.10 |
| Operating System | Arch Linux |
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
CLI - Parcel
The parcel CLI is the most common way to use Parcel. It supports three different commands: serve, watch, and build.
Read more >Parcel is not creating a dist folder when I use build command
When I use the npm start command, it creates a dist folder and server it on localhost, port:1234. But when I use the...
Read more >Bundling and Building with Parcel - Beginner JavaScript
In the terminal, navigate to the dad jokes module refactor exercise folder and install it as a dev dependency using the following command...
Read more >parcel - npm
The actual (somewhat complete) documentation for Parcel 2 is available here: ... Configure the directory where compiled assets are output.
Read more >Package management basics - Learn web development | MDN
dist : The distribution directory — these are the automatically packaged, minified files Parcel has built for us, and the files it is...
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

Remove this line:
Duplicate of https://github.com/parcel-bundler/parcel/issues/4255 (because the src folder should never be overwritten because of a configuration error).
(Also,
--dist-dir ./distisn’t needed, that’s the default already).ok thanks. What should it point to please? My html file is the root of my build