When using the serve mode, the output path is wrong
{
"main": "lib/index.js",
"module": "lib/module.js",
"browser": "lib/browser.js",
"source": ["src/index.ts", "src/cli/index.ts"],
"targets": {
"main": {
"node": ">=10.5.0",
"browsers": "last 1 Chrome versions"
}
},
"scripts": {
"dev": "parcel watch src/index.ts src/index2.ts",
"dev2": "parcel src/index.ts src/index2.ts",
"dev3": "parcel watch src/index.ts",
"dev4": "parcel serve src/index.ts"
},
"dependencies": {
"parcel": "^2.0.0-alpha.1.1"
}
}
The serve mode should use the same output path as the watch mode, which are specified in the main, module and browser package.json properties.
The serve mode currently outputs in the .parcel-cache/dist folder
parcel watch src/index.ts outputs to lib/index.js
parcel serve src/index.ts outputs to .parcel-cache/dist/index.js
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | ^2.0.0-alpha.1.1
| Operating System | Windows 10
This was done intentionally because serve mode works differently from the other modes: only one target is built, and we use a different set of browsers. So, it doesn't really match any of the targets you configure for production. Therefore, we couldn't know which of them to output to. Putting the dist for development inside the cache also ensures that you don't accidentally commit it since .parcel-cache will usually be in .gitignore.
Most helpful comment
This was done intentionally because serve mode works differently from the other modes: only one target is built, and we use a different set of browsers. So, it doesn't really match any of the targets you configure for production. Therefore, we couldn't know which of them to output to. Putting the dist for development inside the cache also ensures that you don't accidentally commit it since
.parcel-cachewill usually be in.gitignore.